Declare and implement the following four functions: 1. void encrypter(char* text
ID: 3541784 • Letter: D
Question
Declare and implement the following four functions:
1. void encrypter(char* text, int csize, int* integers, int *nsize) - Cast the char pointer to an integer pointer and use pointer arithmatic on the integer pointer to copy the char array into the integer array. Remember there are 4 characters per integer. The last integer may go past the last character, which is okay. set nsize to the number of integers that were copied.
2. void decrypter(int * numbers, int nsize, char * text, int * csize) - Cast the integer pointer to a character pointer and use pointer arithmatic on the character pointer to copy the integer array into the char array. Remember there are 4 characters per integer. Set csize to the number of characters that were copied.
3. void encode(char* text, int csize, int* integers, int *nsize, void * encoder(char*, int, int*, int *)) - Apply the passed in ecoder function to the other arguments.
4. void decode(int * numbers, int nsize, char * text, int * csize, void *decoder(int*, int, char*, int *))- Apply the passed in decoder function to the other arguments.
Explanation / Answer
#include <stdio.h> #include <stdlib.h>int main(int argc, char *argv[]) { int n = 260; int *p = &n; char *pp = (char*)p; *pp = 20;
printf("pp = %d ", (int)*pp); printf("n = %d ", (int)n); system("PAUSE"); return 0; }
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.