answersLogoWhite

0

How do you declare variables in pseudo code?

Updated: 8/10/2023
User Avatar

Karleefoss12

Lvl 1
9y ago

Best Answer

In C, the most important rules are:

  • The declaration of a variable must precede its first usage.
  • When you declare a variable, its type must be already defined
  • When in a function, declarations can only be at the beginning of a block, before executable statements.
  • It should not start with any number.
  • Only underscore(_) symbol used in decalaration.
User Avatar

Wiki User

13y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

12y ago

In c, variables are declared by stating their type, followed by a name that you choose, optionally followed by a array specification, optionally followed by an initializer.

int a;

int *a;

int a[3];

int a = 1;

char a[] = "This is a test";

double a = 1.234;

struct _a {

int b;

float c;

} a;
In C++, a variable is declared by writing (inside or outside a function) int x;

Alternately, you can also use long, float, double, string... x; (example: float x;)

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

<Data_Type> <Variable_Name>

ex:- int score

we declare variables using

integers-whole numbers

characters -letters

double-decimals

float-fractions

strings-words

This answer is:
User Avatar

User Avatar

Wiki User

8y ago

You declare a variable in C by declaring the variables type followed by its name. A declaration is also a statement, thus you end the declaration with a semi-colon. You may also include an optional initialiser in a variable declaration.

int x; // declare an uninitialised integer named x.

int y = 42; // declare an initialised integer named y with initial value 42.

Note that you must initialise all variables before you use them. In the above example, we can initialise x via assignment:

x = 100;

Now we can use x in other expressions.

This answer is:
User Avatar

User Avatar

Wiki User

9y ago

Pseudo code is intended to be a short-hand representation of the process. It is often intended to be readable by non-programmers. As such, it is much less strict as far as syntax or structure goes and can vary widely from author to author.

Variables are typically omitted but if you feel the need to include variables any way that makes it clear will do. Any of the following should be clear:

set value to true, var = true

This answer is:
User Avatar

User Avatar

Wiki User

8y ago

It depends on the programming language, please re-ask this question with the language you are asking about in either the question or the categories.

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

It is a request for memory and space in the computer. It also creates storage to be referred to later.

This answer is:
User Avatar

User Avatar

Wiki User

9y ago

Pseudocode is any kind of fake or non-existent programming language so you can declare and use variables however you want.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you declare variables in pseudo code?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you declare local and global variables in pseudo code?

Pseudocode is not a programming language (it's specifically intended for human interpretation), so there is no need to declare variables, you simply define them as and when you require them. For instance: Let x = 42 Let y = x * 2


Does HTML allow you to declare integer real string and boolean variables?

HTML is not a programming language and as such does not allow you to declare variables.


Why is pseudo code called false code?

Pseudo code cannot be processed by a machine, it is solely intended for processing by humans.


What do you mean by implicit and explicit variables declaration in visual basic?

implicit means you must declare variables before using them while explicit is not a must you declare variables before using them


How does pseudo code operate?

It doesn't. Pseudo code isn't a programming language, it is just there to give an idea of how you could write a program.


What is the basic Difference between flow chart and pseudo-code?

what's the difference between flow chart and structure diagrams and pseudo code


Is there an absolute 'right' and 'wrong' way of writing pseudo code?

No. There is no "right way" and "wrong way" of writing pseudo code, let alone qualifying with "absolute". However, a pseudo code is "wrong" if it cannot be understood, or it is incorrect in semantic (what the code tries to describe, solve, etc)


What are the pseudocode keywords for loop?

Pseudo code does not have key words, you make it up, that's why it is pseudo.


What is pseudo code algorithm for create a linked list with a header and insert a four numbers to the list?

pseudo code algorithm to create a linked list


How can i write pseudo code for C plus plus if i haven't even wrote the program yet?

You are going about this backwards. First, define the program. Second, describe its algorithm. Third, if needed, write pseudo code. (Sometime, algorithm and pseudo code is the same process.) Fourth, or third, write real code.


What is the difference of source code object code and pseudo code?

Source code is a sequence of executable instructions written in a particular language. Pseudo code is a sequence of non-executable instructions. It is also called algorithm written in plain English


What travel agency has pseudo city code ky51v?

Pseudo city codes are 3 or 4 charachters long