Function is left value
For anyone who thought that function can only be right value - See this code.
AI
Ringkasan AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Kode Sumber
#include <iostream.h>
int &find(int n);
int vect[10]={0,1,17,2,8,25,32,15,48,5};
int main()
{
int i;
for(i=0;i<10;i++)
cout << vect[i] << " ";
cout << endl;
find(25)=100;
for(i=0;i<10;i++)
cout << vect[i] << " ";
cout << endl;
return 0;
}
int &find(int n)
{
int i;
for(i=0;i<10 && vect[i] != n;i++);
if(n==vect[i])
return(vect[i]);
else
return(vect[0]);
}
Upload
Upload
Komentar Asli (3)
Dipulihkan dari Wayback Machine