For inputing 5 names ( i.e. 5 strings) you can use a 2-D character array , like
char nam[5][10]; // 5 names , each of maximum 10 chracters
int i;
for(i=0;i<5;i++)
{
printf("Enter nam[%d]...
Type: Posts; User: somali.cc
For inputing 5 names ( i.e. 5 strings) you can use a 2-D character array , like
char nam[5][10]; // 5 names , each of maximum 10 chracters
int i;
for(i=0;i<5;i++)
{
printf("Enter nam[%d]...
I am a newbie to C-programming , so just making an effort to get into the logic of ur code.
char nam[5]; means we r declaring an array of 5 elements where each element is a single character OR a...
Oppss....That was a pathetic mistake i made..!!!:tongue:
Thankss Salem...It worked out beautifully for me...Thank u so so much...:redface:
I need to print the following series :
1-1/2+1/3-1/4......+-1/n
where n will be given by user.
I have written the code as :
int main()
int main(void)
{
int a[3][3]={{1,2,3},{5,6,7},{9,0,1}};
printf("\n\n Address of a[1]=%u",&a[1]);
printf("\n\n Value of a[1]=%u",a[1]);
printf("\n\n Element at a[1][0]=%d",*a[1]);
...
I am using Turbo C++ IDE . When I am using the following code :
int main(void)
{
int size=5,arr[size];
.......;
.......;
And I would have to say pls dont try to discourage ppl who want to share and learn C-programming with such out-of-context comments...I have just provided the code that I had felt might work for the...
/* Input 10 numbers in an array and count the number of occurence of an element inside the array */
#include<stdio.h>
#include<conio.h>
void main()
{
@Salem : True, main() always returns integer value.
What if I want a function not to return anything ?
Shud it not be preceede by the keyword void or add another statement : return(0);
...
Thank U Adak..Thanx soo much for the explanation and solution...U rock man..!! :o :redface:
Hi Adak, thnx for replying me.
Using a=tolower(a); cud have been used, but then i cudnt have printed :- The lower-case for A is : a
And yes, i wl definitely go by ur suggestion of using 'a'...
/*Toggle-Case : If lower-case character entered, then change to upper-case and vice-verse :*/
#include<stdio.h>
#include<conio.h>
#include<ctype.h>
void main()
{