Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7407217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:40:45+00:00 2026-05-29T05:40:45+00:00

gcc 4.6.2 c89 I am passing a pointer to a function. This pointer will

  • 0

gcc 4.6.2 c89

I am passing a pointer to a function. This pointer will be passed to another function. And depending on the current value, the value will be changed. So in main the value changed will be value changed in the function.

Because I am going through 2 functions. I just wanted to make sure I haven’t done anything that would cause undefined behaviour. As this will run on a system with high transcations.

I cannot return the value in the return type, as I need to return TRUE or FALSE so see if the function succeeded or failed.

I have run under valgrind and it reports no errors:

valgrind --leak-check=full --verbose ./ptr

Many thanks for any suggestions,

#include <stdio.h>

#define FALSE 0
#define TRUE (!FALSE)

static int incoming_sdp(int *pcmu_priority);
static int parse_incoming_sdp(int *pcmu_priority);

int main(void)
{
    int pcmu_priority = 10;

    printf("Start program pcmu_priority [ %d ]\n", pcmu_priority);

    if(incoming_sdp(&pcmu_priority) == FALSE) {
        /* Something bad happened */
    }

    printf("Final pcmu priority [ %d ]\n", pcmu_priority);

    return 0;
}

/* Removed the processing that will determine of the function is success of failure */
static int incoming_sdp(int *pcmu_priority)
{
    /* Pass the value of the pcmu_prority */
    if(parse_incoming_sdp(pcmu_priority) == FALSE) {
        return FALSE;
    }

    /* Return true or false if processing was successfull */
    return TRUE;
}

/* Removed the processing that will determine of the function is success of failure */
static int parse_incoming_sdp(int *pcmu_priority)
{
    /* Now change the value of the pcum_priority */
    if(*pcmu_priority == 10) {
        *pcmu_priority = 20;
        printf("pcmu is 10 changing pcmu_priority to [ %d ]\n", *pcmu_priority);
    }
    else if(*pcmu_priority == 20) {
        *pcmu_priority = 10;
        printf("pcmu is 20 changing pcmu_priority to [ %d ]\n", *pcmu_priority);
    }

    /* Return true or false if processing was successfull */
    return TRUE;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T05:40:45+00:00Added an answer on May 29, 2026 at 5:40 am

    This program is fine and does not produce an output that depends on undefined behavior.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

gcc 4.4.2 c89 I have a function that has to run (config_relays). It make
gcc 4.4.4 c89 I am just wondering is it worth passing a const into
gcc 4.4.3 c89 I am creating a client server application and I will need
gcc 4.4.4 c89 I have this in my header file. port.h struct struct_tag; int
gcc (GCC) 4.6.0 c89 I have a signal handler declared like this: /* Setup
gcc c89 I am came across this code. typedef __int32 int32_t; typedef unsigned __int32
gcc c89 I am getting a stack dump on this line: strcpy(comp->persons->name, Joe); However,
gcc 4.4.2 c89 I have a file called main.c. I want the result of
gcc 4.4.2 c89 I have this code snippet that I have to repeat in
gcc 4.6.2 c89 I am just wondering if this is a good way to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.