LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Plz debug this... (https://www.linuxquestions.org/questions/linux-newbie-8/plz-debug-this-141504/)

balanagireddy 02-02-2004 04:04 PM

Plz debug this...
 
Can neone plz debug the below program ...
Plz dont mind .I just started programming ....

Here...
#include<stdio.h>

//Program to search occurence of a particular character in an array
int main(void)
{
char a[20];
int n,i,count;
char c;
printf("Enter the no of the characters in the array\n");
scanf("%d",&n);
printf("Enter the characters into the array\n");
for(i=0;i<n;i++)
{
scanf("%c",&a[i]);
}
printf("Enter the character u want to search\n");
scanf("%c",&c);
for(i=0;i<n;i++)
{
count=1;
if(a[i]==c)
{
printf("%d's occurence at %d\n",count,i);
count++;
}
}
return 0;
}
Can neone suggest me a good site for learning C??

Thx for learning....

teval 02-02-2004 06:32 PM

You already posted this in another forum (I know because I replied to it recently)

Please don't post things twice. Makes it hard for people to find the info they need.

XavierP 02-02-2004 06:34 PM

Please do not post the same thread in more than one forum. Picking the most relevant forum and posting it once there makes it easier for other members to help you and keeps the discussion all in one place.

http://www.linuxquestions.org/rules.php

MasterC 02-03-2004 04:17 PM

http://www.linuxquestions.org/questi...hreadid=141526


All times are GMT -5. The time now is 09:33 PM.