En c++ que es void , void que devuelve valor y void que no devuelve ? Y como para que sirve ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

En c++ que es void , void que devuelve valor y void que no devuelve ? Y como para que sirve ?

void que para que rayos

30th Aug 2017, 7:15 AM
carlos serrano
carlos serrano - avatar
3 Answers
+ 2
Ola irmao! Funçoes do tipo void NAO retornam valor (somente exibem mensagens). Se tu usas void, nao podes usar 'return'. Por exemplo: (funçao tipo void, que NAO retorna valor) void exibeBenvindo (){ cout << "Benvindo!" << endl; } (funçao tipo int, que retorna soma de 02 numeros inteiros) int soma (int a, int b){ int resultado; cout << "Informe o valor de A: "; cin >> a; cout << "\nInforme o valor de B: "; cin >> b; resultado = a + b; return resultado; } ---- Cumprimentos do Brasil 🇧🇷
30th Aug 2017, 1:36 PM
Davis Aguiar
Davis Aguiar - avatar
+ 11
Void what the hell !!! Jeez!
30th Aug 2017, 7:47 AM
Babak
Babak - avatar
+ 6
not sure this translation is 100% correct... In c ++ that is void, void that returns value and void that does not return? And what does it serve? Void what the hell
30th Aug 2017, 7:33 AM
jay
jay - avatar