UrbanPro
true

Take BA Tuition from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

C++: Array As Function Argument

Ashutosh Singh
23/12/2017 0 0

Array as Function Argument: C++

 
#include
using namespace std;

void f1(int a[], int size)    //A user-defined function which takes an 'int array'  as arguments
{
  for(int i=0;i<size;i++)
 {
   cout<<a[i]<<endl;
 }

}

int main()
{
    int ar[]={1,2,3,4,5,6,7,8,9,10,11};
    f1(ar,7);    //passing array name and no. of elements(less than actual) to be displayed as args
    f1(ar,11);   //passing array name and no. of elements(equal to actual) to be displayed as args
    f1(ar,15);   //passing array name and no. of elements(more than actual) to be displayed as args
    return 0;
}
 
0 Dislike
Follow 2

Please Enter a comment

Submit

Other Lessons for You

Why Indexing Should Start From Zero In Array ?
Why numbering should start at zero? To denote the subsequence of natural numbers 2, 3, ..., 12 without the pernicious three dots, fourconventions are open to usa) 2 ≤ i < 13b) 1 < i ≤ 12c)...

C++ Overview
Introduction: C++ is the first object oriented programming language used universally as an advanced version of C language. Many features such as Inheritance, Class & Object, Polymorphism(Function...
N

Namrata Y.

0 0
0

Student Project Development: How To Go About It?
A lot of students (count me as well) in their final year of IT course are confused and overwhelmed about their Project development. Final Year IT Projects are a crucial milestone in every IT students educational...

Procedure Oriented Language Vs. Object Oriented Language
Q 1. Explain the terms: Procedure Oriented Programming Object Oriented Programming Ans. Procedure Oriented Programming: In Procedure Oriented Programming: Programs are divided into procedures/...

Goutam Chand Prajapat

0 0
0

Advantages of C++ Language
Advantages of C++ - C++ is a profoundly convenient dialect and is frequently the dialect of decision for multi-gadget, multi-stage application advancement. - C++ is a protest situated programming dialect...

Looking for BA Tuition ?

Learn from Best Tutors on UrbanPro.

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for BA Tuition Classes?

The best tutors for BA Tuition Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Take BA Tuition with the Best Tutors

The best Tutors for BA Tuition Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more