×

C Tutorial

C Basics

C Data Types

C Input/Output

C Operators

C Conditional Statements

C Control Statements

C Strings

C Functions

C Arrays

C Structure and Unions

C Pointers

C Preprocessor Directives

C Command-line Arguments

C File Handlings

C Graphics

C Advance Topics

C Tips and Tricks

C Important Topics

C Practice

Pointer and non-pointer variables declarations together in C?

Learn: How to declare pointer and non-pointer variables together using single declaration statement in C/C++ programming language?

Let suppose, if you want to declare three variables in which two are pointers and one is not a pointer variable, we can declare them in a single line declaration statement.

Consider the following declaration:

int *ptr_a,*ptr_b,c;

Here,
ptr_a - is an integer pointer
ptr_b - is an integer pointer
c - is an integer pointer (a non-pointer variable)

Declaration of integer array and pointer to array together (using single declaration statement)

Consider the given declaration statement:

int arr[100], *ptr;

Here,
arr[100] - is an integer array with 100 elements ptr - is an integer pointer (pointer to an array)


Related Tutorials



Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.