0
What does it means?
I found a code, in this code they are using char bytes_to_send [5]; Next THE FOLLOW lines bytes_to_send [0] = 104; what does this line means? bytes_to_send [1] = 101;what does this line means? bytes_to_send [2] = 109; what does this line means? What 104 101 109 means?
5 Réponses
+ 2
The meaning of these numbers depends on the device to which they are sent (according to the name of the variable, this data is sent somewhere).
If this device is a terminal, then these values will be displayed as letters (then it is strange why they are not written as letters, because it would be more convenient to read the code).
But it can also be some kind of protocol, where the meaning of each byte is determined by this protocol.
For a more accurate answer, you should either write more source code or tell which device this data will be sent to.
+ 1
It is a character array of size 5 with the name bytes_to_send.
The values 104, 101,109 are ASCII values of characters which are stored at the index 0, 1, 2 in the array.
https://code.sololearn.com/c3HPmD30xDf6/?ref=app
+ 1
Can you pass the next two numbers? bytes_to_send[3] and bytes_to_send[4]? it might be clearer by then.
If the sequence were 104, 101, 108, 108, 111 then it's a word "hello".
0
since the variable is char, i assume its a numeric representation of a letter.
try to run this.
char c[4]={104,101,109};
cout<< c;
or
cout<<(char)104;
you'll see a letter they're represent
0
It is an array of type char (its string, store only characters) with length of 5 (store 5 characters, index : 0,1,2,3,4) withe name bytes_to_send.
1st character bytes_to_send[0] = 104; is the same bytes_to_send[0] = 'h';
2nd character bytes_to_send[1] = 101; is the same bytes_to_send[1] = 'e';
3rd character bytes_to_send[2] = 109; is the same bytes_to_send[2] = 'm';
its word "hem".
See this code :
https://code.sololearn.com/chUn9sqh2TM7/?ref=app