I am new to C. I am developing C for an Assembly and C combined code for a project. I need to display simple messages to the Hyper terminal using C.
To be specific, (See attached snippet of code which I am trying to run on Keil toolset) I am trying to declare a global array of characters and process it in one or more functions. Since the Char S statement is outside of Main () so it is global. However if I declare it as extern char s in the cDispMsg routine, I get an error --> " 's' : invalid class error" . On the other hand, if I comment out the extern char s declaration, I get an error -->"subscript on non-array or too many dimensions"
Given all this how can I access the elements of s as in the statements below (see attached file). send them to display or do some processing with them ?
for (i=0; s !='\0';i++)
[By the way ignore the code for SBUF etc., it is for an 8051 embedded controller UART.]
So the bottom line is, can anyone tell me what I am doing wrong and how to fix it ?
if there is some standard way to declare a string or structure and have it accessible from a function ? Does this change if the function is in a different file ?
I tried the examples from K&R's classic book on C but they dont' do much with UARTs, just Printf so many examples are not useful.