In C ,What happen if i unuse the calling function[not a variable] ? i.e user defined function. | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 5

In C ,What happen if i unuse the calling function[not a variable] ? i.e user defined function.

Is this unused function occupies some memory? after running Or it will disappear while running that code? That code is given below... https://code.sololearn.com/c29u8cMBl5vk/?ref=app

17th Oct 2020, 8:40 AM
Yogeshwaran P
Yogeshwaran P - avatar
8 Respuestas
+ 4
If your compiler has optimizing features enabled then it is likely that the function call and function code will be entirely removed from the executable. That would depend on whether the optimizer can determine that removal of the function does not affect anything else.
17th Oct 2020, 10:29 AM
Brian
Brian - avatar
+ 4
Luckily I still have not come across a compiler who called me a fool 😀.
17th Oct 2020, 9:59 PM
Sonic
Sonic - avatar
+ 3
Martin Taylor , codemonkey ,Brian See this below code.which is similar to the above code in this question....(with slight difference) But when I run this code.This code shows warning...... Is this code also suitable to your's answers...? I mean (i.e) is this data(int z) also ignored by the compiler ? || it will also occupy memory......? I raise this code, because it shows warning....😅? https://code.sololearn.com/c0E48BB8V4HR/?ref=app
17th Oct 2020, 2:15 PM
Yogeshwaran P
Yogeshwaran P - avatar
+ 3
codemonkey surely I will ignore the compiler's warning "Hey bro, you have a useless variable,fool!"😅 But ,can you tell me.is compiler ignore that unused variable by removing it [unused variable]? Or it will add this unused variable in memory?
17th Oct 2020, 3:07 PM
Yogeshwaran P
Yogeshwaran P - avatar
+ 3
Thanks you so much to all 🙌🙏for answering unused question..... in sololearn....😅 [i.e question not even seen before || asked in sololearn like this 😁😂]
18th Oct 2020, 1:04 AM
Yogeshwaran P
Yogeshwaran P - avatar
+ 2
Thank you Martin Taylor 😊 can you tell what is stack frame?😅
17th Oct 2020, 8:59 AM
Yogeshwaran P
Yogeshwaran P - avatar
+ 2
Thanks to all🙌🙏
17th Oct 2020, 10:45 AM
Yogeshwaran P
Yogeshwaran P - avatar
+ 2
Unused variables and functions do take up memory. They will generate errors but not warnings.
17th Oct 2020, 9:59 PM
Sonic
Sonic - avatar