Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3487550
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:09:45+00:00 2026-05-18T11:09:45+00:00

First the error: error: a value of type float * cannot be used to

  • 0

First the error:

 error: a value of type "float *" cannot be used to initialize an entity of type "float (*)[2000]"

Heres the relevant code:

#define opType float
const int N = 2000;
opType *a_h,*b_h,*d_h, *a_d,*b_d, *d_d;
opType (*normalized_a)[N] = a_h;
opType (*normalized_b)[N] = b_h;
opType (*normalized_d)[N] = d_h;

opType (*normalized_a_d)[N] = a_d;
opType (*normalized_b_d)[N] = b_d;
opType (*normalized_d_d)[N] = d_d;

I am attempting to normalize it to two dimensions so that I can pass a double pointer to a function later on and reference the two dimensions using the shorthand bracket syntax. I am using CUDA so I must have one dimensional declarations for the copying of the memory. Is there any way to make the above work?

This construct is borrowed from http://forums.nvidia.com/index.php?showtopic=83941&view=findpost&p=475901

int linear[10*32]; // linear array
int (*twodim)[32] = linear; // interpreted as a two-dimensional [10][32] array.
assert(&twodim[2][4] == &linear[2*32 + 4]); // these are the same
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T11:09:46+00:00Added an answer on May 18, 2026 at 11:09 am

    I don’t see where the data for your array initialization comes from, but the error-message is quite clear:
    You declare 6 arrays, each of which contains 2000 float pointers. Of course you can’t initialize one of these arrays with a single float pointer.

    So in what form is your base data and how do you want to use it?

    Edit:
    OK, based on your comment you have got something like

    float myData[N][N];
    

    filled with values. In this form you can already access it as myData[i][j]. Now, if you just cast it over to a float pointer like

    float *myDataFlat = (float*)myData;
    

    you can also access it through myDataFlat[i*N+j].

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I first got an error usign the code below, explaining that DataGridLinkButton' must be
I've just created my first Preview 5 error and it doesn't seem to place
I am taking my first steps programming in Lua and get this error when
I just installed the first release candidate of Python 3.0 and got this error
I am using in the first part of my program On Error GoTo start
I have a SQL Server 2000 database with a column of type VARCHAR(255). All
Why am I getting this error: Error 1 error C2662: 'Allocator::Allocate' : cannot convert
I want to create a simple method that accepts both value type and reference
First, let's get the security considerations out of the way. I'm using simple authentication
First off, I am using Windows XP. I have multiple hard drives and it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.