0
#include <stdio.h>
#include <conio.h>
main()
{     int i;
      char full;
      char array[10]="ABCD";
      for (i=0;i<=6;i++)
          full = array[i];
      
      printf("%c",full);
}

I wanna convert an array to a full character .So that i can print the character like this line printf("%c",full);
This program unable to print the character?? Whats wrong in this prog..??

4
Contributors
3
Replies
5
Views
6 Years
Discussion Span
Last Post by abhimanipal
0

full can hold only a character. Each time you assign a character to full the previous character in full gets erased.

this might help you.

You can give it like this printf( "%s", array ), why go for copying into something.

Edited by Arbus: n/a

0
#include <stdio.h>
#include <conio.h>
main()
{     int i;
      char full;
      char array[10]="ABCD";   // Create the array with 4 letters followed by \0
      for (i=0;i<=6;i++)       // Loop 7 times
          full = array[i];     // copy the first 7 characters into FULL one 
                               // at a time
      
      printf("%c",full);       // output the value of array[6]
}

You are outputting the character. So what is the value of array[6] ?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.