This is an exam question.. please help me #include <stdio.h> int main() { int i; char str1[100] = "Good ", *str2 = "Luck! \n"; //Add your code here printf(str1); } Code (markup): Complete the above C program according to the following requirements: (a). Access and print the letter "k" in the string pointed by str2 using pointer. (b). Concatenate the string pointed by str2 to the end of the string pointed by str1 without using any string operation functions such as strcat(). Based on the above C code, answer following questions: (c). What is the length (number of bytes) of the string pointed by str2? (d). Give the UNIX command to generate the .o file from your .c source code. (.o file need not be submitted) (e). Give the UNIX command to generate the executable file with debugging information. (executable file need not be submitted) Please help me.
What's it worth to ya? Just kidding. #include <stdio.h> int main() { int i; char str1[100] = "Good ", *str2 = "Luck! \n"; // (a) print 'k' using pointer notation printf("%c\n",*(str2+3)); // (b) concatenate str2 into str1 without using strcat() or strlen() for(i=0; str2[i] != 0; i++) str1[5+i] = str2[i]; str1[5+i]=0; // terminate the string // (c) length of string pointed to by str2 is now conveniently sitting in i printf("%d\n",i); printf(str1); // (d) to compile into an object file with debug info: gcc -c -g exam.c -o exam.o // (e) to generate an executable with debug info from the above object file: gcc -g exam.o -o exam } Code (markup):
wow..unreal i just want to say This FOrum Rocks..i mean where else can someone get help like this..I love it here