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

All About Programming And A Good Programmer.
Hi, This is my first lesson for you guys. Hope you enjoy reading it. In recent community questions, I found many people wanted to be good programmers, or wanted to have good hands on certain language,...

For All The New Developers
Language to use: Any language that you are learning. Interface: Web or Desktop Function: Simple calculator (9 digits + symbol) with 1 Memory storage with possible function of + - * / Error Handling...
R

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

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)...

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

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