Solving Assignment Makes Integer from Pointer Without a Cast in C: Tips and Solutions

David Henegar

As a developer, encountering errors while coding is inevitable. One common error that C programmers come across is the "assignment makes integer from pointer without a cast" error. This error message can be frustrating and time-consuming to resolve, but with the right tips and solutions, it can be easily fixed.

Understanding the Error Message

Before we dive into the tips and solutions for fixing this error, let's first understand what it means. The "assignment makes integer from pointer without a cast" error occurs when a pointer is assigned to an integer without a proper type cast. This error message is often accompanied by a warning message that looks like this:

This warning message is telling the programmer that the code is trying to assign a pointer value to an integer variable without casting the pointer to the correct type.

Tips for Fixing the Error

Here are some tips to help you fix the "assignment makes integer from pointer without a cast" error:

Tip #1: Check Your Pointer Types

Make sure that the pointer you are trying to assign to an integer variable is of the correct data type. If the pointer is pointing to a different data type, you will need to cast it to the correct type before assigning it to the integer variable.

Tip #2: Use the Correct Syntax

When casting a pointer to a different data type, make sure to use the correct syntax. The syntax for casting a pointer to an integer is (int) pointer .

Tip #3: Use the Correct Assignment Operator

Make sure that you are using the correct assignment operator. The assignment operator for pointers is = while the assignment operator for integers is == .

Tip #4: Check Your Code for Errors

Double-check your code for errors. Sometimes, the "assignment makes integer from pointer without a cast" error can be caused by a syntax error or a missing semicolon.

Solutions for Fixing the Error

Now that you have some tips for fixing the "assignment makes integer from pointer without a cast" error, let's look at some solutions.

Solution #1: Cast the Pointer to the Correct Type

To fix this error, you need to cast the pointer to the correct type before assigning it to the integer variable. Here's an example:

In this example, the pointer is cast to an integer using the (int) syntax before it is assigned to the num variable.

Solution #2: Declare the Integer Variable as a Pointer

Another solution is to declare the integer variable as a pointer. Here's an example:

In this example, the num variable is declared as a pointer, and the ptr variable is assigned to it without casting.

Q1: What causes the "assignment makes integer from pointer without a cast" error?

A: This error occurs when a pointer is assigned to an integer variable without being cast to the correct data type.

Q2: How do I cast a pointer to an integer in C?

A: To cast a pointer to an integer in C, use the (int) syntax.

Q3: Why is my code still giving me the same error message even after I cast the pointer to the correct type?

A: Double-check your code for syntax errors and missing semicolons. Sometimes, these errors can cause the same error message to appear even after you have cast the pointer to the correct type.

Q4: Can I declare the integer variable as a pointer to fix this error?

A: Yes, you can declare the integer variable as a pointer to fix this error.

Q5: What is the correct assignment operator for pointers and integers in C?

A: The assignment operator for pointers is = while the assignment operator for integers is == .

The "assignment makes integer from pointer without a cast" error can be frustrating, but with the right tips and solutions, it can be easily fixed. By understanding the error message and following the tips and solutions provided in this guide, you can resolve this error and improve the functionality of your code.

Related Links

assignment makes pointer from integer without a cast wint conversion

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to Lxadm.com.

Your link has expired.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.

C Board

  • Today's Posts
  • C and C++ FAQ
  • Mark Forums Read
  • View Forum Leaders
  • What's New?
  • Get Started with C or C++
  • C++ Tutorial
  • Get the C++ Book
  • All Tutorials
  • Advanced Search

Home

  • General Programming Boards
  • C Programming

Assignment makes pointer from integer without a cast

  • Getting started with C or C++ | C Tutorial | C++ Tutorial | C and C++ FAQ | Get a compiler | Fixes for common problems

Thread: Assignment makes pointer from integer without a cast

Thread tools.

  • Show Printable Version
  • Email this Page…
  • Subscribe to this Thread…

Search Thread

  •   Advanced Search
  • Linear Mode
  • Switch to Hybrid Mode
  • Switch to Threaded Mode
  • View Profile
  • View Forum Posts

deciel is offline

I keep getting this error message: "warning: assignment makes pointer from integer without a cast" for line 17 (which I've made red). I've gotten this message a few times before, but I can't remember how I fixed it, and I can't figure out how to fix this one. Any suggestions? Also, it's a code that will take a password entered by the user and then run several for loops until it matches the password. It prints what it's figured out each time it guesses a new letter. Code: #include <stdio.h> #include <string.h> int main(void) { int i, j; char password[25]; char cracked[25]; char *p; char guess = '!'; printf("Enter a password of 25 characters or less: \n"); scanf("%s", password); printf("Password is being cracked..."); for (i = 0, p = password[i]; i < 25; i++, p++) { for(j = 0; j < 90; j++) { if (*p == guess) { strcpy(p, cracked); printf("\t %s \n"); break; } guess++; } //end <search> for loop } //end original for loop return 0; }
Last edited by deciel; 12-13-2011 at 01:57 AM .

JohnGraham is offline

Code: for (i = 0, p = password[i]; i < 25; i++, p++) password[i] is the value at index i of password . You want the address of said value, so you want p = &password[i] (or, equivalently, p = password + i ).
Oh! Thank you, it worked!

sparkomemphis is offline

Originally Posted by deciel I keep getting this error message: "warning: for (i = 0, p = password[i]; i < 25; i++, p++) [/CODE] Note: password[i] == password[0] == *password since this is the assignment portion of for loop and i is set to zero (0).

Tclausex is offline

If you want to set a pointer to the beginning of an array, just use Code: p = password An array name is essentially a pointer to the start of the array memory. Note, for a null terminated string, you could just test for Code: *p //or more explicitly *p == '\0' Also, a 25-element char array doesn't have room for a 25 character string AND a null terminator. And, ask yourself, what's going on when I enter, say a 10 character password, and i > 10.
  • Private Messages
  • Subscriptions
  • Who's Online
  • Search Forums
  • Forums Home
  • C++ Programming
  • C# Programming
  • Game Programming
  • Networking/Device Communication
  • Programming Book and Product Reviews
  • Windows Programming
  • Linux Programming
  • General AI Programming
  • Article Discussions
  • General Discussions
  • A Brief History of Cprogramming.com
  • Contests Board
  • Projects and Job Recruitment

subscribe to a feed

  • How to create a shared library on Linux with GCC - December 30, 2011
  • Enum classes and nullptr in C++11 - November 27, 2011
  • Learn about The Hash Table - November 20, 2011
  • Rvalue References and Move Semantics in C++11 - November 13, 2011
  • C and C++ for Java Programmers - November 5, 2011
  • A Gentle Introduction to C++ IO Streams - October 10, 2011

Similar Threads

Assignment makes pointer from integer without a cast, warning: assignment makes integer from pointer without a cast, warning: assignment makes integer from pointer without a cast, ' assignment makes pointer from integer without a cast ".

  • C and C++ Programming at Cprogramming.com
  • Web Hosting
  • Privacy Statement

Position Is Everything

Makes Pointer From Integer Without a Cast: Fix It Now!

  • Recent Posts

Melvin Nolan

  • MySQL No Database Selected: Actionable Tips to Fix the Error - July 12, 2024
  • How to Un-Snooze Email in Outlook: A Step-by-Step Guide - July 12, 2024
  • How to Search Outlook for Multiple Words: Boost Your Efficiency - July 12, 2024

Makes Pointer From Integer Without a Cast

Our research team has ensured that this will be your best resource on these error messages, and you won’t have to read another article about it again. With that said, launch your code that’s showing the error messages, and let’s fix it for you.

JUMP TO TOPIC

– You Assigned an Integer to a Pointer

– you want to convert an integer to a pointer, – you passed a variable name to the “printf()” function, – you used “struct _io_file” in a wrong way, – you copied a string to an invalid location, – you’re setting a pointer to a different type, – use equal data types during assignment, – ensure the pointer and integer have the same sizes, – pass a “format string” to the “printf()” function, – use a function that returns a pointer to “struct _io_file”, – copy the string to character array or character pointer, – assign pointers of compatible types, why your code made a pointer from an integer without a cast.

Your code made a pointer from an integer without a cast because you assigned an integer to a pointer or you want to convert an integer to a pointer. Other causes include the passing of a variable name to the “printf()” function and using “struct _io_file in the wrong way.

Finally, the following are also possible causes:

  • You copied a string to an invalid location
  • You’re setting a pointer to a different type

If you assign an integer to a pointer, it will lead to the “ assignment makes pointer from integer without a cast c programming ” error. For example, in the following, the “num_array” variable is an unsigned integer type while “tmp_array” is a pointer.

Later, an error will occur when the “for” loop tries to copy the values of the “num_array” to the “tmp_array” pointer using a variable assignment.

#include<stdio.h>

#include<stdint.h>

uint8_t num_array[8] = {0, 1, 2, 3, 4, 5, 6, 7};

void copy_arr_values() {

int i;

uint8_t *tmp_array[8];

for(i=0; i<8; i++){

tmp_array[i] = num_array[(i+3)%8];

}

}

int main() {

copy_arr_values();

}

 

Makes Pointer From Integer Without a Cast Causes

For example, in the following, the “theta” variable is an integer while “ptr_theta” is a pointer. Both have different sizes, and you can’t convert the integer to a pointer.

#include<stdio.h>

int main() {

int theta = 10;

int *ptr_theta = (int *)theta;

}

If you pass a variable name to the “printf()” function, that’s when the compiler will throw the “ passing argument 1 of ‘printf’ makes pointer from integer without a cast ” error.

For example, in the following, “num_val” is an integer variable, and the code is trying to print it using the “printf()” function.

#include <stdio.h>

int main() {

int num_val = 42;

printf(num_val); //Error!

return 0;

}

When you assign an integer to a pointer of “struct _io_file”, that’s when you’ll get the “ assignment to file aka struct _io_file from int makes pointer from integer without a cast ” error. For example, in the following code, “FILE” is a “typedef” for “struct _io_file”. This makes it a pointer to “struct _io_file”.

Later, the code assigned it to the integer “alpha,” and this will lead to an error stated below:

#include <stdio.h>

int main(void) {

int alpha = 10;

FILE *beta = alpha;

return 0;

}

Makes Pointer From Integer Without a Cast Reasons

Now, in the following, the code is trying to copy a string (“source”) into an integer (“destination”), and this leads to an error because it’s not a valid operation:

#include<stdio.h>

#include<string.h>

int main() {

int destination;

char source[] = “Hello, World!”;

strcpy(destination, source);

return 0;

}

When your code sets a pointer to a different type, your compiler will show the “ incompatible pointer type ” error. In the following code, “pacifier” is an integer pointer, while “qwerty” is a character pointer.

Both are incompatible, and your C compiler will not allow this or anything similar in your code.

#include<stdio.h>

int main() {

int charlie = 5;

int *pacifier = &charlie;

char *qwerty = pacifier;

}

How To Stop a Pointer Creation From an Integer Without a Cast

You can stop a pointer creation from an integer without a cast if you use equal data types during the assignment or ensure the integer and pointer have the same sizes. What’s more, you can pass a “format string” to “printf()” and use a function that returns a pointer to “struct _io_file”.

  • Copy the string to a character array or character pointer
  • Assign pointers of compatible types

During a variable assignment, use variables of equal data types. In our first example, we assigned a pointer (uint8_t *tmp_array) to an unsigned integer (uint8_t num_array) and it led to a compile-time error.

Now, the following is the revised code, and we’ve changed “tmp_array” to a real array. This will prevent the “ gcc warning: assignment makes pointer from integer without a cast ” error during compilation.

#include<stdio.h>

#include<stdint.h>

uint8_t num_array[8] = {0, 1, 2, 3, 4, 5, 6, 7};

int main() {

int i;

// Fix: change tmp_array to an array

uint8_t tmp_array[8] = {};

for (i = 0; i < 8; i++){

tmp_array[i] = num_array[(i+3)%8];

}

int length = sizeof(tmp_array)/sizeof(tmp_array[0]);

printf(“Elements of the ‘tmp_array’: \n”);

for (int i = 0; i < length; i++) {

printf(“%d “, tmp_array[i]);

}

}

Makes Pointer From Integer Without a Cast Fixes

Now, the fix is to use “intptr_t” from the “stdint.h” header file because it guarantees that the pointer and integer will have the same sizes. We’ve used it in the following code, and you can compile it without an error.

#include<stdio.h>

#include<stdint.h>

int main() {

int theta = 10;

int *ptr_theta = (int *)(intptr_t)theta;

printf(“%p”, ptr_theta);

}

To fix the “pointer to integer without a cast” in the “printf()” function, pass a “format string” as its first argument. How you write the “format string” depends on the variable that you’ll print. In the following updated code, “num_val” is an integer, so the “format string” is “%d”.

#include <stdio.h>

int main() {

int num_val = 42;

printf(“%d”, num_val);

return 0;

}

When you’re using “FILE” from the “stdlib.h” header file, you can prevent any “pointer from integer” error if you use a function that returns a pointer to “struct _io_file”.

An example of such a function is “fopen()” which allows you to open a file in C programming. Now, the following is a rewrite of the code that causes the pointer error in “struct _io_file”. This time, we use “fopen()” as a pointer to “FILE”.

#include <stdio.h>

int main(void) {

FILE *f = fopen(“myfile.txt”, “r”);

if (f == NULL) {

perror(“Error opening file”);

return 1;

}

char c;

while ((c = fgetc(f)) != EOF) {

printf(“%c”, c);

}

return 0;

}

Makes Pointer From Integer Without a Cast Solutions

Now, in the following code, we’ve changed “destination” from an integer to a “character array”. This means “strcpy()” can copy a string into this array without an error.

#include<stdio.h>

#include<string.h>

int main() {

char destination[100];

char source[] = “Hello, World!”;

strcpy(destination, source);

printf(“%s”, destination);

return 0;

}

Meanwhile, the following is another version that turns the “destination” into a “character pointer”. With this, you’ll need to allocate memory using the “malloc()” function from the “stdlib.h” header file.

#include<stdio.h>

#include<string.h>

#include<stdlib.h>

int main() {

char* destination;

char source[] = “Hello, World!”;

destination = malloc(100);

strcpy(destination, source);

printf(“%s”, destination);

free(destination);

return 0;

}

When you’re assigning pointers, ensure that they’re compatible by changing their data type . The following is the updated code for the “charlie” example , and “qwerty” is now an integer.

#include<stdio.h>

int main() {

int charlie = 5;

int *pacifier = &charlie;

int *qwerty = pacifier;

}

This article explained why your code made a pointer without a cast and how you can fix it. The following is a summary of what we talked about:

  • An attempt to convert an integer to a pointer will lead to the “makes pointer from integer without a cast wint conversion” error.
  • To prevent an “incompatible pointer type” error, don’t set a pointer to a different type.
  • If you’re using the “printf()” function, and you want to prevent any “pointer to integer” error, always pass a “format specifier”.

At this stage, you’ll be confident that you can work with integers and pointers in C programming without an error. Save our article, and share it with your developer communities to help them get rid of this error as well.

Related posts:

  • Input String Was Not in a Correct Format: Working Solutions
  • Best solutions to get rid of “operand should contain 1 column(s)” error
  • Another Git Process Seems To Be Running in This Repository: Solutions
  • Linker Command Failed With Exit Code 1: Causes and Fixes of This Error
  • Valueerror: No Json Object Could Be Decoded: Fix This Python Error
  • Conversion Failed When Converting Date And/or Time From Character String.
  • Importerror: Libcublas.So.9.0: Cannot Open Shared Object File: No Such File or Directory
  • Exception Code 0xe0434352: Read or Let It Disturb You
  • Noclassdeffounderror: An Article That Explains the Details
  • HTTP Error 500.19 – Internal Server Error: Fixing the Issue
  • Libressl SSL_connect: SSL_error_syscall in Connection to Github.com:443
  • Kudu Giving Forbidden Error 403: The Necessary Guide

Leave a Comment Cancel reply

Save my name, email, and website in this browser for the next time I comment.

问题:warning: assignment makes integer from pointer without a cast [enabled by default]

assignment makes pointer from integer without a cast wint conversion

warning: assignment makes integer from pointer without a cast [enabled by default]

C语言在编译过程中有时候会报警告:

这个警告其实不会导致系统运行出错,警告的意思是赋值类型和变量类型不一致导致的。

在这个问题中一般出现的地方如下:

tempStruct *temp = tempStructGet();

这种情况就会出现上述问题,一个函数返回值为一个结构体指针看着是没错的但是赋值就有问题,

修改内容如下:

tempStruct *temp = (tempStruct *)tempStructGet();

将上述内容的返回值强制转化一下就会去掉警告。

assignment makes pointer from integer without a cast wint conversion

请填写红包祝福语或标题

assignment makes pointer from integer without a cast wint conversion

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。 2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

assignment makes pointer from integer without a cast wint conversion

  • Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers
  • Advertising & Talent Reach devs & technologists worldwide about your product, service or employer brand
  • OverflowAI GenAI features for Teams
  • OverflowAPI Train & fine-tune LLMs
  • Labs The future of collective knowledge sharing
  • About the company Visit the blog

Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Get early access and see previews of new features.

c error: assignment makes integer from pointer without a cast [-Werror=int-conversion]

I keep getting the error "assignment makes integer from pointer without a cast [-Werror=int-conversion]" when I try to compile my code. I'm not sure what's going on because I've checked that everything matches the variable type int*.

newSunkList=updateSunkList(sunkList, shipArray) is where the error is.

Silverleaf7's user avatar

  • 2 int* sunkList, newSunkList; will declare sunkList as an integer pointer and newSunkList as an int –  MarcoLucidi Commented May 17, 2020 at 12:42

declares sunkList as an integer pointer ( int * ) and newSunkList as a normal int , thus the warning:

to fix the error you should declare the two variables as follows:

MarcoLucidi's user avatar

Your Answer

Reminder: Answers generated by artificial intelligence tools are not allowed on Stack Overflow. Learn more

Sign up or log in

Post as a guest.

Required, but never shown

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy .

Not the answer you're looking for? Browse other questions tagged c or ask your own question .

  • The Overflow Blog
  • The hidden cost of speed
  • The creator of Jenkins discusses CI/CD and balancing business with open source
  • Featured on Meta
  • Announcing a change to the data-dump process
  • Bringing clarity to status tag usage on meta sites
  • What does a new user need in a homepage experience on Stack Overflow?
  • Feedback requested: How do you use tag hover descriptions for curating and do...
  • Staging Ground Reviewer Motivation

Hot Network Questions

  • Can this dragon fly with a rider?
  • Does the average income in the US drop by $9,500 if you exclude the ten richest Americans?
  • Is it safe to install programs other than with a distro's package manager?
  • Maximisation of product
  • Escape from the magic prison
  • how did the Apollo 11 know its precise gyroscopic position?
  • What should I do if my student has quarrel with my collaborator
  • How can I measure the speed of sound with an oscilloscope and ultrasonic sensor? (Currently getting low value.)
  • Did Babylon 4 actually do anything in the first shadow war?
  • Why are poverty definitions not based off a person's access to necessities rather than a fixed number?
  • Fusion September 2024: Where are we with respect to "engineering break even"?
  • How do you tip cash when you don't have proper denomination or no cash at all?
  • Can I Use A Server In International Waters To Provide Illegal Content Without Getting Arrested?
  • How to run only selected lines of a shell script?
  • Sylvester primes
  • Current in a circuit is 50% lower than predicted by Kirchhoff's law
  • How can I give alternate numbered distance in a 2D array in Geometry Nodes?
  • What was the first "Star Trek" style teleporter in SF?
  • Would an LEO asking for a race constitute entrapment?
  • Is it helpful to use a thicker gage wire for part of a long circuit run that could have higher loads?
  • Confusion about time dilation
  • Cohomological range of a perverse sheaf
  • When has the SR-71 been used for civilian purposes?
  • Why isn't a confidence level of anything >50% "good enough"?

assignment makes pointer from integer without a cast wint conversion

Get the Reddit app

A subreddit for all questions related to programming in any language.

assignment makes integer from pointer without a cast

By continuing, you agree to our User Agreement and acknowledge that you understand the Privacy Policy .

Enter the 6-digit code from your authenticator app

You’ve set up two-factor authentication for this account.

Enter a 6-digit backup code

Create your username and password.

Reddit is anonymous, so your username is what you’ll go by here. Choose wisely—because once you get a name, you can’t change it.

Reset your password

Enter your email address or username and we’ll send you a link to reset your password

Check your inbox

An email with a link to reset your password was sent to the email address associated with your account

Choose a Reddit account to continue

IMAGES

  1. Array : Assignment makes integer from pointer without a cast [-Wint-conversion

    assignment makes pointer from integer without a cast wint conversion

  2. [Solved] Assignment makes integer from pointer without a

    assignment makes pointer from integer without a cast wint conversion

  3. assignment makes integer from pointer without a cast

    assignment makes pointer from integer without a cast wint conversion

  4. Makes Pointer From Integer Without a Cast: Fix It Now!

    assignment makes pointer from integer without a cast wint conversion

  5. Making An Integer From A Pointer Without A Cast: A Comprehensive Guide

    assignment makes pointer from integer without a cast wint conversion

  6. assignment makes integer from pointer without a cast -wint-conversion

    assignment makes pointer from integer without a cast wint conversion

VIDEO

  1. C pointer arithmetic without object with your question

  2. 2. Declaring & Initializing Pointers in C++

  3. Pointers in C++

  4. Pointer Assignment in C

  5. 8. Double pointer, double fun

  6. 8.3

COMMENTS

  1. Assignment makes pointer from integer without cast

    However, this returns a char. So your assignment. cString1 = strToLower(cString1); has different types on each side of the assignment operator .. you're actually assigning a 'char' (sort of integer) to an array, which resolves to a simple pointer. Due to C++'s implicit conversion rules this works, but the result is rubbish and further access to ...

  2. C pointers and arrays: [Warning] assignment makes pointer from integer

    In this case a[4] is the 5th integer in the array a, ap is a pointer to integer, so you are assigning an integer to a pointer and that's the warning. So ap now holds 45 and when you try to de-reference it (by doing *ap) you are trying to access a memory at address 45, which is an invalid address, so your program crashes.. You should do ap = &(a[4]); or ap = a + 4;

  3. Assignment makes integer from pointer without a cast in c

    We are trying here to assign the return of getinteger function which is a pointer that conatains a memory address to the result variable that is an int type which needs an integer Case 3: Misusing ...

  4. Makes Integer From Pointer Without A Cast (Resolved)

    Converting Integers to Pointers {#converting-integers-to-pointers} To convert an integer to a pointer, follow these steps: Include the <stdint.h> header (C) or the <cstdint> header (C++) in your program. Cast your integer to the required pointer type using a double cast. int a = 42; uintptr_t int_ptr = (uintptr_t)&a;

  5. Assignment Makes Integer From Pointer Without A Cast In C (Resolved)

    Solving Assignment Makes Integer from Pointer Without a Cast in C: Tips and Solutions

  6. Assignment makes pointer from integer without a cast

    Assignment makes pointer from integer without a cast Getting started with C or C++ | C Tutorial | C++ Tutorial | C and C++ FAQ | Get a compiler | Fixes for common problems Thread: Assignment makes pointer from integer without a cast

  7. [C] Cannot get rid of a [-Wint-conversion] warning

    initialization makes pointer from integer without a cast You are initializing your reversed_arr variable, which is a pointer to a char, with the result of the reverse function, which returns a char (which is basically an integer), which is why you are getting your warning. You could try: char *reversed_arr = (char *) reverse(arr);

  8. "assignment makes integer from pointer without a cast -wint-conversion

    "assignment makes integer from pointer without a cast -wint-conversion" problem I am new to c language and I wanted to make a calculator so I wrote this code:

  9. Makes Pointer From Integer Without a Cast: Fix It Now!

    How To Stop a Pointer Creation From an Integer Without a Cast. - Use Equal Data Types During Assignment. - Ensure the Pointer and Integer Have the Same Sizes. - Pass a "Format String" to the "Printf ()" Function. - Use a Function That Returns a Pointer to "Struct _IO_file". - Copy the String to Character Array or Character ...

  10. c

    1. Earlier, I asked a similar question, but I've since changed my code. Now the compiler gives me a different warning. This is an example of what my code looks like now: void *a = NULL; void *b = //something; a = *(int *)((char *)b + 4); When I try to compile, I get "warning: assignment makes pointer from integer without a cast."

  11. Need help with C, keep getting "assignment makes pointer from integer

    char *word is a pointer, meaning the value contained by the word parameter is a memory address (in this example, it will be the address of the first character in a string). When you use the notation *word on line 19, you are dereferencing the word pointer, meaning it will return the value of whatever is stored at word's memory address (which is a single character).

  12. Assignment makes integer from pointer without a cast [-Wint-conversion

    warning: assignment makes integer from pointer without a cast [-Wint-conversion . c; arrays; pointers; variable-assignment; uint8t; Share. Follow edited Jan 17, 2016 at 15:36. Sourav Ghosh. 134k 16 ... Return makes integer from pointer without a cast [-Wint-conversion] 0.

  13. Assignment makes integer from pointer without a cast and ...

    OK - in that case, since you want to immediately change the value of sad, it can be a local variable to the function, and doesn't need to be an argument to the function: . void racun(int D, int M, int G, int *dUg) { int i, *sad; If you want sad to point to an array, such that accessing sad (sad[...]) will be equivalent to accessing that array (e.g. obicna[...]), you can simply assign the array ...

  14. C语言assignment makes pointer from integer without a cast

    C语言assignment makes pointer from integer without a cast. 这个警告的意思是将一个int整数值直接赋值给了一个指针变量。. (重点是类型不一致). 消除警告的方法就是明确类型转换是否是正确的,如果确实要把整数变量赋予指针变量,那么请使用 强制类型转换。. 否则 ...

  15. 问题:warning: assignment makes integer from pointer without a cast

    C语言在编译过程中有时候会报警告:. warning: assignment makes integer from pointer without a cast [enabled by default] 这个警告其实不会导致系统运行出错,警告的意思是赋值类型和变量类型不一致导致的。. 在这个问题中一般出现的地方如下:. tempStruct *temp = tempStructGet ...

  16. assignment makes integer from pointer without a cast

    assignment makes integer from pointer without a castc/c++ warning explained#syntax #c/c++ #compiler #error #warning

  17. Array : Assignment makes integer from pointer without a cast [-Wint

    Array : Assignment makes integer from pointer without a cast [-Wint-conversionTo Access My Live Chat Page, On Google, Search for "hows tech developer connect...

  18. assignment makes integer from pointer without a cast -wint-conversion

    In your if statement and else statement, you're assigning the char "+" and "=" to the variable that is checked. To check for equivalence, you would have to do "==" which is the equivalence operator.

  19. c error: assignment makes integer from pointer without a cast [-Werror

    assignment makes integer from pointer without a cast [-Werror=int-conversion] Hot Network Questions Is the set of all non-computable numbers closed under addition?

  20. assignment makes integer from pointer without a cast [-wint-conversion

    The warning message "assignment makes integer from pointer without a cast" occurs when a pointer value is assigned to a non-pointer variable. The non-pointer variable can hold an integer value, but the pointer value is a memory address.The C programming language has very strict type checking. Therefore, attempting to store a pointer value in an ...

  21. assignment makes integer from pointer without a cast

    text should be declared as: char *text = NULL; You need a pointer to char. This pointer can be set to point to any literal string (as you do in your case statements). char text; // this is just a single character (letter), not a string. 2. Objective_Ad_4587 • 3 yr. ago. i got it thank you very much.