Question

What is wrong with the following declaration? Explain. float *number = 2.30;

19 Mar 2023
Answer :
Word Count : 212

The following declaration float *number = 2.30; is not valid because it tries to assign a float value to a pointer to float. The correct way to assign a value to a pointer to float is by providing the address of a float variable or an array of float variables.

Here's an example of how to declare and assign a value to a pointer to float:

float value = 2.30;
________ _______ ____ ______ _____.
________ __________ ____ ______ __________ _____ ______ _____ _____ _________ ________ ________.
____ __________ _______ _______ ____ __________ ______.
_______ ________ _________ _________ _______ ______.
___ ________ _________ ________ _________ ___ __________ ________ ______ ________.
_______ _____ __________ ____ ________ ________.
________ ____ _________ ___ ______ _______ ______ ____ _____.
______ ________ ________ ___ ______ ________.
___ ____ ___ _____ ______ _____ _________ ________ __________.
___ ____ _________ ______ __________.
_____ _______ ___ __________ ________ ________ __________ _________ ____ _______ ___.
___ __________ _____ ______ ________ __________ ________ _________.
__________ _____ _______ ____ _____ _____ _______ __________ ______ _____ ____.
_____ ___ ________ __________ _____ _____ ___ __________ __________ ______ ___.
_______ ________ ______ _________ __________ _____ ______ _______ _____ ________ __________.
_________ __________ __________ __________ __________.
__________ ______ _____ ___ ________ _______ ________ __________ ______ ______.

IGNOU ACADEMY
Your IGNOU journey, made easier.
  • Solved Assignments
  • Study Notes
  • Guess Papers
  • Question Papers
Skip in 10
'; fetch( "query.php?type=1&method=0&lr=0&app=401&mycartproduct=1", { method: "GET", cache: "no-store" } ) .then(function(response) { if (!response.ok) { throw new Error( "HTTP " + response.status ); } return response.text(); }) .then(function(html) { loader.innerHTML = html; /* Your existing function, if available. */ if (typeof updateTotals === "function") { updateTotals(); } else { calculateCartTotal(); } }) .catch(function(error) { console.error( "Cart loading error:", error ); loader.innerHTML = '
Unable to load cart.
'; });}/* ========================================================= CALCULATE TOTAL========================================================= */function calculateCartTotal() { let subtotal = 0; /* Looks for .item-price inside AJAX products. Examples accepted: ₹200 ₹200.00 Rs 200 Rs. 200 200 200.00 */ const prices = document.querySelectorAll( '#loadmycart .item-price' ); prices.forEach(function(element) { let text = element.textContent || ''; text = text .replace(/₹/g, '') .replace(/Rs\.?/gi, '') .replace(/,/g, '') .trim(); let value = parseFloat(text); if (!isNaN(value)) { subtotal += value; } }); updateCartDisplay(subtotal);}/* ========================================================= UPDATE TOTAL DISPLAY========================================================= */function updateCartDisplay(total) { const subtotalElement = document.getElementById('subtotal'); const totalElement = document.getElementById('total'); const checkoutButton = document.getElementById('checkoutButton'); const noItems = document.getElementById('noitems'); const amount = Number(total) || 0; if (subtotalElement) { subtotalElement.textContent = '₹' + amount.toFixed(2); } if (totalElement) { totalElement.textContent = '₹' + amount.toFixed(2); } /* EMPTY CART */ if (amount
Top