Run-Time Check Failure #2 - Stack around the variable 'letterarray' was corrupted.
I've been trying to figure this stack corruption issue.I know the corruption comes from writing outside the allocated buffer in memory.However,I couldn't understand where ?
#include <stdio.h>
main(){
int letterarray[25];
int n,i,c;
for(i=0;i<26;i++)
letterarray=0;
while((c=getchar())!='*')
letterarray[c-97]++;
for(n=0;n<26;n++)
{putchar('a'+n);printf(" ");}
printf("\n");
for(i=0;i<26;i++)
printf("%d ",letterarray);
}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement