fork(6) download
  1. #include <stdio.h>
  2. #include<string.h>
  3. struct name
  4. {
  5. char name[21];
  6. }ar;
  7. int main(void) {
  8. int t,i,j,c=0,count=0,n;
  9. scanf("%d",&t);
  10. while(t--)
  11. {
  12. scanf("%d",&n);
  13. char temp[21];
  14. for(i=0;i<n;i++)
  15. {
  16.  
  17. scanf("%s",ar[i].name);
  18. }
  19. for(i=0;i<n;i++)
  20. {
  21. count=1;
  22. strcpy(temp,ar[i].name);
  23. if(strcmp(ar[i].name,"ullu")!=0)
  24. {
  25. for(j=i+1;j<n;j++)
  26. {
  27. if(strcmp(temp,ar[j].name)==0)
  28. {
  29. strcpy(ar[i].name,"ullu");
  30. count++;
  31. }
  32. }
  33. }
  34. if(count %2!=0)
  35. c++;
  36. }
  37. printf("%d\n",c);
  38. }
  39. // your code goes here
  40. return 0;
  41. }
  42.  
Compilation error #stdin compilation error #stdout 0s 2056KB
stdin
1
8
Shubham
Hasil
Shubham
Ravi
Shikhar
Hasil
Jaiwant
Hasil
compilation info
prog.c: In function 'main':
prog.c:17:16: error: subscripted value is neither array nor pointer nor vector
   scanf("%s",ar[i].name);
                ^
prog.c:22:18: error: subscripted value is neither array nor pointer nor vector
    strcpy(temp,ar[i].name);
                  ^
In file included from /usr/include/string.h:635:0,
                 from prog.c:2:
prog.c:23:16: error: subscripted value is neither array nor pointer nor vector
    if(strcmp(ar[i].name,"ullu")!=0)
                ^
prog.c:23:16: error: subscripted value is neither array nor pointer nor vector
    if(strcmp(ar[i].name,"ullu")!=0)
                ^
prog.c:23:16: error: subscripted value is neither array nor pointer nor vector
    if(strcmp(ar[i].name,"ullu")!=0)
                ^
prog.c:23:16: error: subscripted value is neither array nor pointer nor vector
    if(strcmp(ar[i].name,"ullu")!=0)
                ^
prog.c:23:16: error: subscripted value is neither array nor pointer nor vector
    if(strcmp(ar[i].name,"ullu")!=0)
                ^
prog.c:23:16: error: subscripted value is neither array nor pointer nor vector
    if(strcmp(ar[i].name,"ullu")!=0)
                ^
prog.c:23:16: error: subscripted value is neither array nor pointer nor vector
    if(strcmp(ar[i].name,"ullu")!=0)
                ^
prog.c:23:16: error: subscripted value is neither array nor pointer nor vector
    if(strcmp(ar[i].name,"ullu")!=0)
                ^
prog.c:23:16: error: subscripted value is neither array nor pointer nor vector
    if(strcmp(ar[i].name,"ullu")!=0)
                ^
prog.c:23:16: error: subscripted value is neither array nor pointer nor vector
    if(strcmp(ar[i].name,"ullu")!=0)
                ^
prog.c:23:16: error: subscripted value is neither array nor pointer nor vector
    if(strcmp(ar[i].name,"ullu")!=0)
                ^
prog.c:23:16: error: subscripted value is neither array nor pointer nor vector
    if(strcmp(ar[i].name,"ullu")!=0)
                ^
prog.c:23:16: error: subscripted value is neither array nor pointer nor vector
    if(strcmp(ar[i].name,"ullu")!=0)
                ^
prog.c:23:16: error: subscripted value is neither array nor pointer nor vector
    if(strcmp(ar[i].name,"ullu")!=0)
                ^
prog.c:23:16: error: subscripted value is neither array nor pointer nor vector
    if(strcmp(ar[i].name,"ullu")!=0)
                ^
prog.c:23:16: error: subscripted value is neither array nor pointer nor vector
    if(strcmp(ar[i].name,"ullu")!=0)
                ^
prog.c:23:16: error: subscripted value is neither array nor pointer nor vector
    if(strcmp(ar[i].name,"ullu")!=0)
                ^
prog.c:23:16: error: subscripted value is neither array nor pointer nor vector
    if(strcmp(ar[i].name,"ullu")!=0)
                ^
prog.c:23:16: error: subscripted value is neither array nor pointer nor vector
    if(strcmp(ar[i].name,"ullu")!=0)
                ^
prog.c:23:16: error: subscripted value is neither array nor pointer nor vector
    if(strcmp(ar[i].name,"ullu")!=0)
                ^
prog.c:27:22: error: subscripted value is neither array nor pointer nor vector
     if(strcmp(temp,ar[j].name)==0)
                      ^
prog.c:27:22: error: subscripted value is neither array nor pointer nor vector
     if(strcmp(temp,ar[j].name)==0)
                      ^
prog.c:27:22: error: subscripted value is neither array nor pointer nor vector
     if(strcmp(temp,ar[j].name)==0)
                      ^
prog.c:27:22: error: subscripted value is neither array nor pointer nor vector
     if(strcmp(temp,ar[j].name)==0)
                      ^
prog.c:27:22: error: subscripted value is neither array nor pointer nor vector
     if(strcmp(temp,ar[j].name)==0)
                      ^
prog.c:27:22: error: subscripted value is neither array nor pointer nor vector
     if(strcmp(temp,ar[j].name)==0)
                      ^
prog.c:27:22: error: subscripted value is neither array nor pointer nor vector
     if(strcmp(temp,ar[j].name)==0)
                      ^
prog.c:27:22: error: subscripted value is neither array nor pointer nor vector
     if(strcmp(temp,ar[j].name)==0)
                      ^
prog.c:27:22: error: subscripted value is neither array nor pointer nor vector
     if(strcmp(temp,ar[j].name)==0)
                      ^
prog.c:27:22: error: subscripted value is neither array nor pointer nor vector
     if(strcmp(temp,ar[j].name)==0)
                      ^
prog.c:27:22: error: subscripted value is neither array nor pointer nor vector
     if(strcmp(temp,ar[j].name)==0)
                      ^
prog.c:27:22: error: subscripted value is neither array nor pointer nor vector
     if(strcmp(temp,ar[j].name)==0)
                      ^
prog.c:27:22: error: subscripted value is neither array nor pointer nor vector
     if(strcmp(temp,ar[j].name)==0)
                      ^
prog.c:27:22: error: subscripted value is neither array nor pointer nor vector
     if(strcmp(temp,ar[j].name)==0)
                      ^
prog.c:27:22: error: subscripted value is neither array nor pointer nor vector
     if(strcmp(temp,ar[j].name)==0)
                      ^
prog.c:27:22: error: subscripted value is neither array nor pointer nor vector
     if(strcmp(temp,ar[j].name)==0)
                      ^
prog.c:27:22: error: subscripted value is neither array nor pointer nor vector
     if(strcmp(temp,ar[j].name)==0)
                      ^
prog.c:27:22: error: subscripted value is neither array nor pointer nor vector
     if(strcmp(temp,ar[j].name)==0)
                      ^
prog.c:27:22: error: subscripted value is neither array nor pointer nor vector
     if(strcmp(temp,ar[j].name)==0)
                      ^
prog.c:27:22: error: subscripted value is neither array nor pointer nor vector
     if(strcmp(temp,ar[j].name)==0)
                      ^
prog.c:29:15: error: subscripted value is neither array nor pointer nor vector
      strcpy(ar[i].name,"ullu");
               ^
stdout
Standard output is empty