Question
this is a Makeargs method for C: convert 3D array to 2D Array or dereference the 2D arrsy, i was told the argv parameter passed
this is a Makeargs method for C:
convert 3D array to 2D Array or dereference the 2D arrsy, i was told the argv parameter passed in was a 3D array but im not sure if i heard that correctly..
Step 1 make a copy of S
Step 2 tokenize copy & count tokens using strtok_r
step 3 make a 2D ararat and the # of rows
step 4 tokenize s, dynamically allocate memory for the token, strcopy/strncpy
i have provided some examples and my code of how it works now but i dont think it it working right or if it is supposed to print out what i have. can someone explain this for me? i can provide you with more information as well
cscd240_w20_lab8.pdf For example, given the following C code int main() char **argv, s [] - "ls -1 file"; int argc; argc = makeargs (s, &argv); printargs (argc, argv); }// end main The results of makeargs would be: argc would be 3. argv[0] would be 'ls' argv[1] would be 'I' argv[2] would be file argv[3] would be "VO You must not waste memory, and any memory you allocate you must for(x = 0; xStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started