About 15,000,000 results
Open links in new tab
  1. c - using array in condition - Stack Overflow

    Aug 17, 2012 · I want to check an array in a condition. Let's take this simple code below: int array[] = {1,2,3,4,5}; // initializing an array. if(array[] == {1,2,3,4,5}) // using as condition. …

  2. Declare an array inside if statement - C++ Forum - C++ Users

    Jun 28, 2014 · You must use the proper limit in your getline () call. If the size of the array is not large enough to hold the desired value then you must increase the size of the array, not just …

  3. c++ - How to use an array element in if-statement? | DaniWeb

    In one function, the user will enter a 9-character string that will be stored in an array (AcctNum [10], to allow for the terminating null-character). One of the things I want to do is to verify that …

  4. C++ If...else (With Examples) - Programiz

    The if...else statement is used to run one block of code under certain conditions and another block of code under different conditions. In this tutorial, we will learn C++ if, if…else and nested …

  5. C++ Arrays - GeeksforGeeks

    May 14, 2025 · In C++, we can create/declare an array by simply specifying the data type first and then the name of the array with its size inside [] square brackets(better known as array …

  6. c - Declaring arrays inside an if statement - Stack Overflow

    Aug 1, 2013 · Use this instead : char *y; if(x == 's') y = "sauve"; else y = "hi"; printf("%s",y); By declaring y before the if statement and not inside, you are extending the y scope. And you …

  7. C++ If ... Else - W3Schools

    Use the if statement to specify a block of C++ code to be executed if a condition is true. Note that if is in lowercase letters. Uppercase letters (If or IF) will generate an error. In the example …

  8. Why array variable doesn't work inside the IF statement of C?

    May 24, 2023 · I wrote a C program using VS code, and tried to assign a string to an array inside an If-statement of C language. But it doesn't work. However, only integer variables are …

  9. arrays - If statement - C++ - Stack Overflow

    Dec 9, 2017 · You need to use a for-loop to iterate over the elements: if(redsigma[i] meets conditions) { I recommend that you use std::vector instead of an array. @Russsu a vector is …

  10. arrays within an if statement - C++ Forum - C++ Users

    Nov 2, 2009 · Getting a bit stuck trying to put an if statement to test weather the array value entered is bigger or equal to 1 and smaller than or equal to ten. I've tried numbers …

Refresh