double-pointer Questions
1
I was porting some older high-speed C++ code to C#, and the existing code made use of a pointer-based double-indirection pattern like this (written here in a C# syntax), using the stack as efficien...
Sandrasandro asked 27/5, 2022 at 13:37
9
Solved
Suppose I have an array of pointers to char in C:
char *data[5] = { "boda", "cydo", "washington", "dc", "obama" };
And I wish to sort this array using qsort:
qsort(data, 5, sizeof(char *), comp...
Realize asked 15/8, 2010 at 20:39
8
I am having trouble understanding how to assign memory
to a double pointer.
I want to read an array of strings and store it.
char **ptr;
fp = fopen("file.txt","r");
ptr = (char**)malloc(sizeof(...
Merl asked 13/2, 2010 at 13:48
5
Solved
Please consider the following code:
#include <stdio.h>
#include <stdlib.h>
#define NUM_ARRAYS 4
#define NUM_ELEMENTS 4
#define INVALID_VAL -1
int main()
{
int index = INVALID_VAL;
...
Passionate asked 20/12, 2012 at 14:11
3
Solved
I was looking at https://en.cppreference.com/w/cpp/language/reinterpret_cast and I noticed that it specifies the legal types we can always cast to:
byte*
char*
unsigned char*
But I did not see ...
Gee asked 17/4, 2019 at 13:31
4
Please find the code snippet as shown below:
#include <stdio.h>
int My_func(int **);
int main()
{
int a =5;
int *p = &a;
My_Func(&p);
printf("The val of *p is %d\n"...
Dishonesty asked 9/6, 2013 at 8:44
1
Solved
I'm a COBOL programmer , and my latest project is to connect a COBOL application to a SQLite3 database.
I have been following this guide, and their solution is exactly what I would need in my COBO...
Electrodynamics asked 18/12, 2015 at 13:24
3
Solved
Simple question here: is there any way to convert from a jagged array to a double pointer?
e.g. Convert a double[][] to double**
This can't be done just by casting unfortunately (as it can in pl...
Zorn asked 20/5, 2009 at 20:34
2
Solved
I'm almost there but I can't quite understand how to convert
unsigned char ** to a cv::Mat
I know that the .data part of a cv::Mat is uchar*
I'm using a function that returns and image in the ...
Fridafriday asked 6/11, 2012 at 16:40
5
Imagine you have a class defined as follows.
public class SomeClass
{
public Manager m { get; protected set; }
public SpecialData data { get; protected set; }
//More methods and member code he...
Balsamiferous asked 18/9, 2014 at 14:20
2
I have to write a function which takes in 2 double pointers (both to char type). The first double pointer has a string of query values and the 2nd one has stopwords. The idea is to eliminate the st...
Morie asked 6/7, 2013 at 4:32
1
Solved
I wanna use double pointer and I tried to declare like this.
NSString **a;
but, Xcode showed me the error "Pointer to non-const type 'NSString *' with no explicit ownership" and it couldn't be c...
Byrdie asked 28/2, 2013 at 22:14
3
Solved
In C, I am using a char ** to hold a series of strings.
Here is my code:
char ** c;
//now to fill c with data ????
//cannot change:
printf ("%*s%s", 0, "", *c);
while (*++w)
printf (" %s", *c);...
Main asked 28/1, 2013 at 2:52
2
Solved
I am trying to get the number of rows and columns of a 2D Array from a double pointer pointed to the array.
#include <stdio.h>
#include <stdlib.h>
void get_details(int **a)
{
int ro...
Helvetia asked 18/10, 2012 at 23:39
3
Solved
I want to a member variable, which is a double pointer. The object, the double pointer points to shall not be modified from outside the class.
My following try yields an
"invalid conversion from ...
Canonicals asked 8/6, 2011 at 18:45
1
© 2022 - 2024 — McMap. All rights reserved.