Argument-passing may refer to two different things: (1) the process of providing a program being started with some initial pieces of information (the arguments) on its command line; (2) the process of providing the initial values (the arguments) for the parameters of a function when it is called.
Questions tagged [argument-passing]
777 questions
-2
votes
4 answers
Function does not return any value in C
I'm trying to make a calculation in C and trying to return the result value of a mathematical calculation but nothing prints out to screen when passing to main fuction. I have tried various methods but something is missing. Can you help me correct…

knoxgon
- 1,070
- 2
- 15
- 31
-2
votes
2 answers
Segmentation fault in passing matrix to C function
I can't figure out what is wrong with this chunk of code (and couldn't find any advice from previous Q&A):
#include
void fld(const int **b){
int i, j ;
printf("Hello R\n");
for (i=0; i<3; i++){
for (j = 0; j<3; j++)
…

brnady
- 29
- 4
-2
votes
3 answers
python: iteratively change sys.argv
I'm sure this is a common question but I'm such a python newbie I don't know how to search for the question.
I have a script with a function like so:
firstarg = sys.argv[1]
secondarg = sys.argv[2]
def examplefunc(firstarg):
#does…

prply
- 23
- 1
- 5
-2
votes
1 answer
How to get data from model with parameter in codeigniter
hello everyone i have a question about get data from model with parameter, i can't call data in view
this is my model
function nilai_mahasiswa($ni_dos,$kd_smt,$kd_kls){
$data_nilai_mahasiswa = $this->db->query("SELECT…

Learn Again
- 17
- 1
- 5
-2
votes
1 answer
@ARGV in Perl (command line arguments)
(Please before flagging the question, read it first! I know that similar questions have been asked, yet in different and incomplete forms).
I'm trying to find what the natural and normal way is to handle command line arguments or script options.…

Ali Abbasinasab
- 382
- 3
- 13
-2
votes
1 answer
Passing arguements through main - Checking to see if a valid input
I'm trying to pass arguments through main, which works fine, I then check to see if the passed in argument contains the correct format/value. However, even if I pass through the correct format it still shows that there is something wrong, here is…

Phorce
- 2,632
- 13
- 43
- 76
-2
votes
2 answers
How to pass a pointer as an array argument?
I have a third-party library, which has a function delared as follows:
void foo(const void* input, char output[1024]);
If I write something like this:
char* input = "Hello";
char output[1024];
foo(input, output); // OK
But I don't want to declare…

xmllmx
- 39,765
- 26
- 162
- 323
-3
votes
2 answers
Segmentation Fault when passing an array to a function
I'm trying to pass a 2D array to a function using pointers. The function is going to initialise the array.
I get a segmentation fault: 11 at run time
The code is as follows
typedef struct {
char name[100];
int runs;
int batstatus;
…

iMinion
- 11
- 3
-3
votes
2 answers
How to pass objects between two Java classes with main
Basically I create a custom object in one program and instantiate with values in one program, then I create another program and want to print the instantiated object output.
import java.util.Scanner;
class example {
int value;
String name;
…

Creative_Cimmons
- 255
- 1
- 2
- 11
-3
votes
3 answers
"const *int" or just "int" as function-arguments. What is the difference?
void test(const int* pInt)
or
void test(int pInt)
I know that the first example makes pInt some kind of protected. But which solution provides more performance? Since both (the const pointer and the normal int) have to be registered in the…

user1511417
- 1,880
- 3
- 20
- 41
-4
votes
1 answer
C - passing structure + members by value
my questions here always seem to be about using functions. It still confuses me! In this textbook exercise i am asked to pass a structure by value, then adjust it and pass by reference. Initially I designed the code to have everything done in main.…

steeele
- 31
- 1
- 7
-5
votes
3 answers
Too many arguments to function call, What do I do?
I am working on a problem in my textbook and I need to make a triangle angle calculator Im used to java but Im not 100% on C yet, I don't understand the logic in it.
#include
static float angleB;
static float angleA;
float…

Ethan Cole Merbaum
- 11
- 1
- 5