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
PayPal Gateway not configured
PayPal Gateway not configured