c - What's with the program why is it not printing any result? -


  स्ट्रक्चर नोड {int data; संरचना नोड * अगला; }; शून्य पुश (स्ट्रक्चर नोड * हेड, स्ट्रक्चर नोड * n) {if (n! = NULL) {if (head == NULL) head = n; Else {n- & gt; अगले = सिर; सिर = n; }} और printf ("एक नल नोड सम्मिलित नहीं किया जा सकता"); } संरचना नोड * पॉप (स्ट्रक्चर नोड * हेड) {if (head! = NULL) {struct node * n = head; सिर = सिर- & gt; अगला; वापसी n; } Else {printf ("स्टैक रिक्त है"); वापसी नल; }} int main () {int i; संरचना नोड * सिर = नल, * n; के लिए (i = 15; i & gt; 0; i -) {struct नोड * temp = malloc (sizeof (struct नोड)); अस्थायी - & gt; डेटा = i; Temp- & gt; अगले = नल; धक्का (सिर, अस्थायी); } N = सिर; जबकि (n! = NULL) {printf ("% d", n-> डेटा); एन = n- & gt; अगले; } वापसी 0; }  "post-text" itemprop = "text"> 

आपको फ़ंक्शन पुश पर पॉइंटर हेडर के पते को पास करना होगा। मैं आपके मामले में सिर संशोधित नहीं हो रहा है क्योंकि आप केवल सिर में मान दे रहे हैं।

  शून्य पुश (स्ट्रक्चर नोड ** सिर, स्ट्रक्चर नोड * n) {if (n! = NULL) {if (* head == NULL) * head = n; Else {n- & gt; अगले = * सिर; * सिर = n; }} और printf ("एक नल नोड सम्मिलित नहीं किया जा सकता");} int main () {int i; संरचना नोड * सिर = नल, * n; के लिए (i = 15; i & gt; 0; i -) {struct नोड * temp = (struct नोड *) malloc (sizeof (struct नोड)); अस्थायी - & gt; डेटा = i; Temp- & gt; अगले = नल; धक्का (& amp; सिर, अस्थायी); } N = सिर; जबकि (n! = NULL) {printf ("% d", n-> डेटा); एन = n- & gt; अगले; } वापसी 0;}    

Comments

Popular posts from this blog

c# - passing input text from view to contoller with FacebookContext using Facebook app -

ios - Does Core Data autoupdate a many to many relationship on saving -

Calling a C++ function from C# by passing a string with variable size to it -