How to pop the stack and keep track of charFlag, in C?

/* Below is am popping the stack, which works, but it does not keep track of the charFlag variable that is pushed onto the stack. Can you help me with modifying this *char pop (stackNodePtr ptr) so when it pops the value from the stack, and keeps track of the charFlag?
Thank you very much in advance for your assistance!!!
Note: This posts is an offspring of my previous question: _"Why is the stack, written in C, converting + to ascii 42 ?"_. I want to thank Xnav for the excellent suggestion of including a character flag to keep track of the datatype being pushed onto the stack. Thank you etresoft for variable renaming comment.
typedef struct stackNode {
int value;
int charFlag;
struct stackNode *next;
}stackNode;
typedef stackNode * StackNodePtr;
char pop( StackNodePtr *ptr )
if( StackIsEmpty(*ptr))
printf("
Pop attempted, but the Stack is empty, or underflow");
exit(2);//needed stdlib.h to work
else
char sTop;
StackNodePtr old;
if( (old = (StackNodePtr ) malloc( sizeof (StackNodePtr) )) == NULL )
printf("
No memory left for pop operation");
sTop = (*ptr)->value;
old = *ptr;
*ptr = (*ptr)->next;
free(old);
return (sTop);

//I added a global variable int gCharFlag to keep track of the popped charFlag. Will the code below work, or should I just return (*ptr)? Thank you once again!
//struct, typedef and gCharFlag are stored inside of a .h file
typedef struct stackNode {
int value;
int charFlag;
struct stackNode *next;
}stackNode;
typedef stackNode * StackNodePtr;
int gCharFlag;//global variable, which is stored inside of a .h file
//below method is stored inside of a .c file
char pop( StackNodePtr *ptr )
if( StackIsEmpty(*ptr))
printf("
Pop attempted, but the Stack is empty, or underflow");
exit(2);//needed stdlib.h to work
else
char sTop;
StackNodePtr old;
if( (old = (StackNodePtr ) malloc( sizeof (StackNodePtr) )) == NULL )
printf("
No memory left for pop operation");
sTop = (*ptr)->value;
gCharFlag = (*ptr)->charFlag;
old = *ptr;
*ptr = (*ptr)->next;
free(old);
return (sTop);//to return the struct node, then it would be return (*ptr), correct?

Similar Messages

  • Can anyone tell me how to use the loops and backing tracks with a single guitar input? I can't seem to figure out how to set this up

    I am trying to configure Mainstage to input my own guitar and add a backing track from the library or a loop but, I can figure out how to open or add the tracks I've downloaded. Any help would be great

    did you try the PlayBack preset/template?
    once you open the PlayBack plug-in you just load the tracks from the plug-in's menu.

  • Please help me figure out how to quiet the fan and keep my computer on

    My PowerMac, running on OS X (10.4.11) keeps going to sleep and the top fan makes an incredibly loud noise.
    How can I get it to stop shutting off and quiet the fan down?

    Hello,
    At the Apple Icon at top left>About this Mac.
    Then click on More Info>Hardware and report this upto *but not including the Serial#*...
    Hardware Overview:
    Machine Name: Power Mac G5 Quad
    Machine Model: PowerMac11,2
    CPU Type: PowerPC G5 (1.1)
    Number Of CPUs: 4
    CPU Speed: 2.5 GHz
    L2 Cache (per CPU): 1 MB
    Memory: 10 GB
    Bus Speed: 1.25 GHz
    Boot ROM Version: 5.2.7f1
    Have you blown the dust out of it lately?
    Get Temperature Monitor to see if it's heat related...
    http://www.macupdate.com/info.php/id/12381/temperature-monitor
    iStat Menus...
    http://bjango.com/mac/istatmenus/
    And/or iStat Pro...
    http://www.islayer.com/apps/istatpro/
    If you have any temps in the 70°C/160°F range, that's likely it.

  • How to register and keep track on item packaging during transactions

    Hi,
    I have items which I receive in inventory under different packaging. I want that when I receive or issue it from the warehouse, I keep track also on the packaging that the transaction is done.
    E.g. Oil for vehicle engine:
    Item parameters: "10x40"
    Manufacturer: Elf
    I receive:
    100 liters, 100 pieces, package: 1 liter.
    500 liter, 100 pieces, package: 5 liter.
    I want to know that I have in total 600 liters of Oil 10x40 of manufacturer Elf and from the other hand I want to know how many pieces of 1 liter and how many of 5 liters I have.
    Please help me to configure this in INV module.
    Thank you.

    Hi Glen, 
    Thanks heaps for your reply! Sorry I am so slow to implement it, send it to my client, and then realise it is borked still!  I went with the storing the ICalUid (which I think IS the CleanGlobalObjectId you mentioned after I dissected the blogs you
    posted) in my database.  I stored the ICalUid of the appointment on the server, and the ICalUid of the one I created on the client in it's SQLCE database.  This allowed me to find one from the other for updates and deletes or so I thought.  Updates
    are fine.  But I still cannot find the deleted appointment on the server, or get enough info from the server, to find the right item to delete on the client.  I can no longer access the ICalUid of the appointment on the server because first I have
    to find the appointment in deleteditems or recoverabledeletions folder to get the ICalUid (or CleanGlobalObjectId).  SyncFolderItems returns the subject but not startdate so I cannot search in deleted etc using that combo and I don't feel subject alone
    will be reliable enough at all.  So, what you proposed works beautifully, but not for my initial problem, which was deleting.  
    Maybe this is microsoft fault but SyncFolderItems does not seem to return enough info to perform an accurate delete of an item.  If it helps at all I am following this example: http://msdn.microsoft.com/en-us/library/exchange/ee693003(v=exchg.80).aspx but
    of course the good folks at MS haven't filled in the important bits!
    LucasF

  • How can I delete the video and keep the Audio  in a few frames using Imovie 11

    How can I delete the video and keep the Audio  in a few frames using Imovie 11?

    I've met the problem too before. but i solved it with  Audio Converter Mac instead of iMovie. If you have similar situation that just want to keep audio but not video, and if your file format is not workable in iMovie, you can use the Audio Converter for help too. it can easily help to extract audio soundtrack from any video format. Or if you need to convert one audio format to another, it is a good choice too, because it supports many common audio output formats.
    <Link Edited By Host>

  • I need to move 1000 photos from one library to another. How do I do that and keep the ratings and dates they were created?

    I need to move 1000 photos from one library to another. How do I do that and keep the ratings and dates they were created? I tried exporting them, but it loses all info. Also, how do I move the quicktime movies from one iphoto library to another? They were exported as jpgs

    Add both libraries to iPhoto Library Manager.  Then select the events or albums that you want to copy from library A  and drag them to library B in iPLM.
    This video shows the process:
    OT

  • How can I hide the borders and keep it as an option?

    How can I hide the borders and keep it as an option?  I had someone go into the css I believe, and make it so there were no borders visible on the page (I could see the dotted outline while working on it, but when pushed, it wasn't visible (which is what I wanted).  They called it "noborders."  Since I had to reinstall, it went away.  Help?
    I have Dreamweaver CS5.5

    Try this site:  CSS Border
    Add code then type in a zero. Later add border size you want.
    examples:  border: 0px solid black;
    or
    border: 1px 000000;
    or
         border-top-style: solid; 0px 000000;
         border-right-style: dotted; 0px 000000;
         border-bottom-style: solid; 2px 000000;
         border-left-style: dashed; 1px 000000;

  • HT201317 My iPhone is running out of storage.  I want to delete a bunch of photos on my phone.  I have iCloud.  How do I delete photos from the iPhone and keep them on my computer?  I need to free up storage as my phone will no longer take photos.

    My iPhone is running out of storage.  I want to delete a bunch of photos on my phone.  I have iCloud.  How do I delete photos from the iPhone and keep them on my computer?  I need to free up storage as my phone will no longer take photos.

    The only way you can do that is to import them into your library first, but you may have done that already.
    The easiest way to tell is to select a photo from the photostream album in iPhoto and ctrl-click on it, if it gives you the option to import it isn't in your iPhoto library, if it offers you the option to show in library it has already been imorted.

  • How to configure the runtime and consolidation for a track in CMS.

    How to configure the runtime and consolidation for a track in CMS.
    I can see the track exists in CMS but the same doesnt pull up in the NWDS in the development configuration perspective.
    I compared the given track with the one which gets pulled up in NWDS. Theres something called runtime system and consolidation which isnt defined for the track which is invisible.
    Please advise , what are these required for. And how can we configure the same.

    The runtime systems are defined for a track to setup the Transport path for any code changes....the Consolidation system is usually defined as a Virtual system for the track and used for comparison and fixing any broken or Dirty DC's ....that means it's not used as a Runtime System for Deployment as compared to DEV,QAT and PROD used for Deployment...
    Hope it helps..
    Regards,
    Shikhil

  • How do I cut out the vocals and keep the instrumentals

    I recorded a track and I just want to keep the instumentals and discard the vocals. Is there a way to break it down and just discard the vocals and keep the instrumentals?

    From a professionally recorded stereo recording (that's not what you originally said) you can possibly reduce the vocals
    http://www.thehangtime.com/gb/gbfaq2.html#removevocals
    A better option would be to find a MIDI file of the song you want.

  • How to export an album and keep images in the same order in elements 11 mac

    I made an album of my trip to Australia (lots of pictures) and changed the order of the images (not the same as shooting order) and when I export the images in the album to a folder or memorystick, the images are copied to that place but I lost the album order of the images.
    How can I prevent that, without having to renumber al 500 images separatly?
    Gr Jos

    Thanks for the tip, Michel
    It worked like a charm…
    cheers Jos
    Op 28 okt. 2013, om 18:49 heeft MichelBParis <[email protected]> het volgende geschreven:
    Re: How to export an album and keep images in the same order in elements 11 mac
    created by MichelBParis in Photoshop Elements - View the full discussion
    JosU a écrit:
    I made an album of my trip to Australia (lots of pictures) and changed the order of the images (not the same as shooting order) and when I export the images in the album to a folder or memorystick, the images are copied to that place but I lost the album order of the images.
    How can I prevent that, without having to renumber al 500 images separatly?
    Gr Jos
    The order in album is only kept in the organizer database, so the only way not to lose that order is to rename files.
    If you are using the 'export' function, select your album in custom order, select all photos and in the dialog, choose to rename with a common base name.
    Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/5794538#5794538
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/5794538#5794538
    To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/5794538#5794538. In the Actions box on the right, click the Stop Email Notifications link.
    Start a new discussion in Photoshop Elements at Adobe Community
    For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • How do I make and keep a copy of a photo in iPhoto so that I can edit the copy and keep the unedited original?

    How do I make and keep a copy of a photo in iPhoto (version 9.5.1) so that I can edit the copy and keep the unedited original?

    You don't have to. iPhoto does that automatically. Note the command in Photos menu to 'Revert to Original' and the original can be exported at any time using the Export command.
    Longer answer:
    All edits in iPhoto are virtual. The database records your decisions and then applies them to a copy of the original. So your original is untouched. Your edited version is never "fixed" until you export it.

  • My start button and desk top menu keep relocating themselves to top, and sides, How do I get them back on the botom of the page and keep them there?

    When I initialize my start up, and my home page loads, my start button, short cut icons, and desk top menu will move from the bottom where I prefer them, to the top, or left and tight sides, which shortens my home page, or any site I go to. How do I lock them in to the bottom and keep them there. This has just started in the past 2 weeks.

    Drag the Taskbar with the Start button to the wanted position and right click that bar the lock it to prevent accidental moving it.

  • I've a video with an extra translator voice how can I remove the translator and keep the original voice ?

    I've a video with an extra translator voice how can I remove the translator and keep the original voice ?

    I got the quicktime 7 pro but that did not solve my problem I need to listen to the origenal voice on my video  however  in window properties there is only delete the it deleted all the voices together :'( helllllllllp someone

  • Hello All... Back after a brief absence, things look a little bit different. I'm trying to take a 16 minute mini dv video and compress it for use on the web. I'm interested in any suggestions you may have on settings for the video and audio tracks. I'v

    Hello All...
    Back after a brief absence, things look a little bit different.
    I'm trying to take a 16 minute mini dv video and compress it for use on the web. I'm interested in any suggestions you may have on settings for the video and audio tracks. I've tried using Sorenson 3 (15 frames, key frames set to automatic, 320 x 240) for video and IMA 4:1 (mono) for audio. The resulting video looked great but the file size came in at about 255 Mb.
    Thanks!
    PowerMac G5 1.8 Dual   Mac OS X (10.4.3)  
    Message was edited by: Dan Foley

    Thank you for the replies.  Everyone was correct about the jack, interface, and phasing problems.  I have been unplugging my motu audio interface and then using headphones at work.  I have not changed any detailed audio output settings in logic.  When I read that the jack might be a problem I tried switching headphones.  This actually helped.  I am using dre-beats headphones and they seem to be having issues with the mac/jack-(the phasing/panning problems.  I can use these headphones with other devices but not the mac.  I have to use ipod ear buds and the phasing seems fixed.  Hopefully this information is helpful to someone else. 
    If anyone knows how to correct this issue please let me know its difficult to know what my final mixes are going to sound like and I have had to keep bouncing everything into i-tunes- sync to ipod and then listen in my car radio. 

Maybe you are looking for