Course Solutions Uncategorized (Solved) : Linux Using C Language 1 Try Explain Behaves Strange Fix Int X1 Char X2 12 X1 33 Strcpy X2 Q27757493 . . . .

(Solved) : Linux Using C Language 1 Try Explain Behaves Strange Fix Int X1 Char X2 12 X1 33 Strcpy X2 Q27757493 . . . .

 

In Linux using by c++ Language

1) Try below and explain why it behaves strange. How can you fixit?

int x1;

char x2[12];

x1=33;

strcpy(x2,”abcdefghijkl”);

printf(“%d %s”,x1,x2);

2) What is wrong with the following program? How can you fixit?

void getstr(char *str){

   printf(“enter a stringn”);

   scanf(“%s”, str);

}

int main(){

   char * strarr[10]={NULL};

   getstr(strarr[0]);

   printf(“we got %sn”, strarr[0]);

}

3) Write a program that reads a long sentence and displays thefrequency of each word as below. It also prints the word that hasthe maximum frequency. Use as many functions as possible to splityour program into small pieces.

   algorithm:

      read a line

      tokenize

      display tokens

      compute frequency

         for eachtoken

             if it is already in

OR

PayPal Gateway not configured

OR

PayPal Gateway not configured

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post