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 7218941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T21:33:11+00:00 2026-05-28T21:33:11+00:00

here i have one function which is call many times in one application this

  • 0

here i have one function which is call many times in one application this application is running continuously.

Here i am take one character array size of 1024.
here i am declaring char input[1024];

so which is best way

1)    char input[1024];
2)    char input[1024] = NULL;

this thing will not create any memory issue after so many times if we used this function.char input[1024];

i think may be after using input we have to make NULL ?
or in declaration we have to declare this thing as char input[1024] = NULL; so when it will be called next time so that time first input make null than its taking any memory.

#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>

void do() {

        char input[1024];

    strcat(input,"ussp-push 04:18:0F:B1:48:B5@9");
    strcat(input,"> dev/null&");

    if(system(input)  != 0)
    {
        printf("\nFailed command\n");
    }
    else
    {
            printf("\nSuccesss command\n");
    }

}
  • 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-28T21:33:12+00:00Added an answer on May 28, 2026 at 9:33 pm

    Your program does not initialise input at all. This can lead to buffer overrun and even if that does not happen, your program is likely to have incorrect results. Thus your code invokes undefined behaviour.

    Presumably you actually want to initialize input to be an empty string. Like this:

    char input[1024] = "";
    

    Once you have done this your calls to strcat will work.

    If you don’t want to initialise input then you can use strcpy instead of the first strcat:

    char input[1024];
    strcpy(input, "ussp-push 04:18:0F:B1:48:B5@9");
    

    If ever you need to assign the empty string to input later in the code do it like this:

    input[0] = '\0';
    

    The code you suggest, char input[1024] = NULL is not valid. It does not compile.

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

Sidebar

Related Questions

I have one javascript function. Which i want to call on hover of li
Here's the deal. I have a big class hierarchy and I have this one
i have one jquery function which i need to work in following way 1.
I have a python function which uses a regular expression to match one (the
Here is my situation: I have one table that contains a list of drugs
so here's the problem I have one form, it outputs search results after submit,
here is the problem. I have one PC using VS2008 (SP1 ) and another
Just wondering what little scripts/programs people here have written that helps one with his
Ok, so here's what I want to do, preferably with jQuery 1.4.2: Have one
I have a one-to-one relationship but hibernatetool complains when generating the schema. Here's an

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.