Quantcast
Channel: Microcontrollers, Programming and IoT
Viewing all articles
Browse latest Browse all 1271

Print the string of structure

$
0
0
I want to print the string of structure what's the problem in my code. How to print the string of structure

Code:
#include<stdio.h>
struct profile
{
   char name[10];
   int number;
};

int main()
{
    struct profile account;
    account.number = 132;
    account.name[10] = "Joy";

 unsigned int i;

 for(i =0; i < 10; i++);

   printf(" name %s \n",account.name[i]);

   printf(" number %d \n",account.number);

   return 0;
}

Viewing all articles
Browse latest Browse all 1271

Trending Articles