# Thread: how to write this cout<< in C

1. ## how to write this cout<< in C

how to do write this in C

Code:
` cout<<numbers[n]<<",";`
there are 5 elements in the numbers array. but when i write
Code:
` printf("%d", numbers[n]);`
I only get the first number. ie 10.

here is the whole code

Code:
``` #include <stdio.h>

int main (){
int numbers;
int *p;
p = numbers;

*p = 10;
p++;
*p = 20;
p = &numbers;
*p = 30;
p = numbers + 3;
*p = 40;
p = numbers;
*(p + 4) = 50;

for (int n = 0; n<5; n++) {
//cout<<numbers[n]<<",";
printf("%d" , numbers[n]);
return 0;
}
}``` 2. cause your return 0; is inside your for loop and thus it exits on the first iteration. 3. Oh, Yes thank you nonpuz. Popular pages Recent additions
{"ft_lang_label":"__label__en","ft_lang_prob":0.6652629,"math_prob":0.9968853,"size":472,"snap":"2019-51-2020-05","text_gpt3_token_len":170,"char_repetition_ratio":0.1965812,"word_repetition_ratio":0.0,"special_character_ratio":0.44915253,"punctuation_ratio":0.25210086,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99859,"pos_list":[0,1,2,3,4,5,6,7,8,9,10],"im_url_duplicate_count":[null,null,null,null,null,null,null,null,null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-12-08T10:12:44Z\",\"WARC-Record-ID\":\"<urn:uuid:7dcfce4a-c217-4ec6-bcc5-4406384c4d1b>\",\"Content-Length\":\"48044\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:7ddb2ce9-dedd-4699-9feb-024c8269a19a>\",\"WARC-Concurrent-To\":\"<urn:uuid:66953bcb-f232-41f4-8b2e-46204a6eade9>\",\"WARC-IP-Address\":\"198.46.93.160\",\"WARC-Target-URI\":\"https://cboard.cprogramming.com/c-programming/125983-how-write-cout-c.html?s=71e7b8cd332e50b0ef0bf72985a79274\",\"WARC-Payload-Digest\":\"sha1:2UWBQE3WMZRVE2VYN2VHT44AMAWXEOKX\",\"WARC-Block-Digest\":\"sha1:64QIONJS6YHUXIZLRPRVS63N6JQPSKEH\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-51/CC-MAIN-2019-51_segments_1575540508599.52_warc_CC-MAIN-20191208095535-20191208123535-00241.warc.gz\"}"}