Oct 21, 2012 at 2:03pm UTC
NEED HELPP
what's wrong with my code??
it doesnt work >___<
please help me.
#include <stdio.h>
#include <string.h>
int main()
{ int i,j,n;
char a[10][20],t[20];
printf(“Enter the number of strings :”);
scanf(“%d”,&n);
for(i=0;i<n;i++)
scanf(“%s”,a[i]);// read the strings
for(i=0;i<n-1;i++) //bubble sort
for(j=0;j<n-1-i;j++)
if(strcmp(a[j],a[j+1])>0)
{ strcpy(t,a[j]);
strcpy(a[j],a[j+1]);
strcpy(a[j+1],t);
}
printf(“The strings after sorting are : n”);
for(i=0;i<n;i++)
{
printf(“ %s”,a[i]);// print the strings
printf(“n”);
}
}
The error says:
error C2065: '“The' : undeclared identifier
: error C2146: syntax error : missing ')' before identifier 'strings'
error C2059: syntax error : ')'
error C2065: '“' : undeclared identifier
error C2065: 's”' : undeclared identifier
: error C2065: '“n”' : undeclared identifier
Last edited on Oct 21, 2012 at 2:04pm UTC
Oct 21, 2012 at 2:27pm UTC
Last edited on Oct 21, 2012 at 2:29pm UTC
Oct 21, 2012 at 2:29pm UTC
You're using an accented quote (“), not a standard double ("). The compiler doesn't recognize the accented quote and therefore doesn't recognize what's inside them as a literal.
PLEASE USE CODE TAGS (the <> formatting button) when posting code.
Last edited on Oct 21, 2012 at 2:35pm UTC