I am writing a C program to access a string into an array from a pointer array in Visual Studio 2010.
Program is given below:-
I am getting some junk character first and then my actual data on console window.Code:#include <stdio.h> #include <string.h> void main() { char data_a[6],data_b[6]="ABcde",*ptr; ptr=&data_b[0]; data_a[0]=*ptr; printf("%s",a); }
I want to where I am getting wrong and how to resolve it.