I think this will print the whole string. "Joy"
I made program for this
#include <stdio.h>
int main()
{
char account.name[10] = "Joy";
printf("Print content of account.name : %s \n", account.name);
return 0;
}
This program doesn't print anything but when I remove dot(.)...
I have explained with example please look at post #5
see the difference between both code
#include<stdio.h>
int main (void)
{
int number[100]= {1,2,3,4,5};
printf("array element : %d \n", number[0]);
printf("array element : %d \n", number[1]);
printf("array element : %d \n"...
printf("Print content of account.name : %d \n", account.name);
account.name = 5
This statement will print the content of account.name. so if the account.name = 5 , then this will print 5
printf(" Print content of account.name: %d \n", account.name )
This statement will print the...
Please look at post #5
I understand array in c. I have written program for array in post #5
I know the difference between this two
int number[5] = {1,2,3,4,5};
Array storing 5 number's
int number[5] = {"12345"};
string of 5 numbers with a null terminator.
This section will print the content of string.
char name[4] = "Joy";
...
printf("Name is %s\n",name);
This section will not print the string
the name of string is wrong, it should name
char name[10];
...
printf(" name %s \n",account.name);
There is difference between string name [I]
I think I am missing some basics.
I am explaining why the loop
loop is use to check the size of array and store to array element
#include<stdio.h>
int main (void)
{
int number[5]= {1,2,3,4,5};
printf("array element : %d \n", number[0]);
printf("array element : %d \n"...
Yes I understand statement and loop in c programming
string
#include <stdio.h>
int main()
{
char name[4] = "Joy";
printf("Name is %s\n",name);
return 0;
}
Name is Joy
length of a string
#include <stdio.h>
int main()
{
char name[100], i;
printf("Enter a string: ")...
I want to print the string of structure what's the problem in my code. How to print the string of structure
#include<stdio.h>
struct profile
{
char name[10];
int number;
};
int main()
{
struct profile account;
account.number = 132;
account.name[10] = "Joy";
unsigned...
I have make it simple
#include <stdio.h>
int main(void)
{
int a[10], i, j, n, temp;
printf ("\n Pramot user to Enter size: ");
scanf ("%d", &n);
for (i = 0; i < n; i++)
{
printf ("\n Enter the element: ");
scanf ("%d", &a[i]);
}...
Where do you find wrong me in my understanding ?
Here loop run 5 times , first it set to 0 than increase by 1 until it get 4 and then stop
#include <stdio.h>
int main (void)
{
int N = 5;
int i;
for (i=0; i < N; i++)
{
printf ("Number = %d \n",i);
}
return 0;
}
Number =...
I was showing you that I understand what is "for (j = 0 ; j <(n-1); j++)"
I am stuck in three parts of the for statement. I don't know what is use of them ?
It check the value n-1 value then print the value of j
#include <stdio.h>
int main()
{
int j, n;
printf("value of n : ");
scanf("%d", &n);
for (j = 0 ; j <n-1; j++)
printf(" j : %d \n",j);
return 0;
}
value of n : 4
j : 0
j : 1
j : 2
Yes I understand use of "for" loop
#include <stdio.h>
int main (void)
{
int N = 10;
int i;
for (i=0; i<N; i++)
{
printf ("Number %d \n",i);
}
return 0;
}
Number 0
Number 1
Number 2
Number 3
Number 4
Number 5
Number 6
Number 7
Number 8
Number 9
Hello
I am looking help to understand this program.
array in ascending order in C programming
#include <stdio.h>
int main(void)
{
int a[20], i = 0, j = 0, n, t;
printf ("\n Pramot user to Enter Element: ");
scanf ("%d", &n);
printf ("\n");
for (i = 0; i < n; i++)...
The C compiler automatically add null character '\0' at the end of the string which indicates the end of the string
char variable store only one letter and it take 1 byte memory space. one char variable store ASCII value of one character.
string is combination of many letters like...
we can use loop to store limited value
#include <stdio.h>
int main()
{
char Book [11] = {'E','l','e','c','t','r','o','n','i','c','s'};
int i;
for (i = 0; i < 11; i++)
{
printf("Name of Book is = %c \n",Book[i]);
}...